frontend: extend debugging/plugin api
This commit is contained in:
parent
06e081d785
commit
0198955f7d
3 changed files with 36 additions and 5 deletions
22
frontend/src/debuggingapi.js
Normal file
22
frontend/src/debuggingapi.js
Normal file
|
@ -0,0 +1,22 @@
|
|||
import gateway from './gateway';
|
||||
import { getItem, init, setItem, removeItem } from './storage';
|
||||
import { allStores } from './stores';
|
||||
import { authWithToken, logOut } from './auth';
|
||||
|
||||
export function useDebuggingApi() {
|
||||
window.__waffle = {
|
||||
gateway,
|
||||
storage: {
|
||||
getItem,
|
||||
setItem,
|
||||
removeItem,
|
||||
init
|
||||
},
|
||||
auth: {
|
||||
authWithToken,
|
||||
logOut
|
||||
},
|
||||
stores: allStores,
|
||||
app: null
|
||||
};
|
||||
}
|
|
@ -1,14 +1,11 @@
|
|||
import Main from './components/Main.svelte';
|
||||
import gateway from './gateway';
|
||||
import { getItem, init } from './storage';
|
||||
import { authWithToken, useAuthHandlers } from './auth';
|
||||
import { initResponsiveHandlers } from './responsive';
|
||||
|
||||
window.__waffle = {
|
||||
gateway
|
||||
};
|
||||
import { useDebuggingApi } from './debuggingapi';
|
||||
|
||||
init();
|
||||
useDebuggingApi();
|
||||
initResponsiveHandlers();
|
||||
useAuthHandlers();
|
||||
authWithToken(getItem("auth:token"));
|
||||
|
@ -22,5 +19,6 @@ if (loadingElement) {
|
|||
const app = new Main({
|
||||
target: document.body
|
||||
});
|
||||
window.__waffle.app = app;
|
||||
|
||||
export default app;
|
|
@ -295,3 +295,14 @@ export const gatewayStatus = new GatewayStatusStore();
|
|||
export const messagesStoreProvider = new MessagesStoreProvider();
|
||||
export const userInfoStore = new UserInfoStore();
|
||||
export const overlayStore = new OverlayStore();
|
||||
export const allStores = {
|
||||
selectedChannel,
|
||||
showSidebar,
|
||||
showChannelView,
|
||||
smallViewport,
|
||||
channels,
|
||||
gatewayStatus,
|
||||
messagesStoreProvider,
|
||||
userInfoStore,
|
||||
overlayStore,
|
||||
};
|
||||
|
|
Loading…
Reference in a new issue