diff --git a/frontend/src/debuggingapi.js b/frontend/src/debuggingapi.js new file mode 100644 index 0000000..a8c0d43 --- /dev/null +++ b/frontend/src/debuggingapi.js @@ -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 + }; +} \ No newline at end of file diff --git a/frontend/src/main.js b/frontend/src/main.js index a6a7562..c59bd50 100644 --- a/frontend/src/main.js +++ b/frontend/src/main.js @@ -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; \ No newline at end of file diff --git a/frontend/src/stores.js b/frontend/src/stores.js index f1967c2..45c2fa4 100644 --- a/frontend/src/stores.js +++ b/frontend/src/stores.js @@ -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, +};