Reputation: 376
I'm debugging the Svelte app and wondering if it is possible to access svelte data in the store from the web console? Does somebody know if it is possible, if it yes, how pls :)
And by the way, we are still using svelte 1.
Upvotes: 4
Views: 3024
Reputation: 229
You can access the props, state and store with the official svelte browser extension
Upvotes: 0
Reputation: 7250
Following is a neat way to access store:
1.Define a property (ex: store
) on window object and have its getter to log the store data.
Object.defineProperty(window, "store", {
get : _ => {
environmentV2.subscribe(e => console.log(e))
}
});
2.Type store
in your console and press enter. You will see the store data as follows:
Upvotes: 4
Reputation: 16411
During initialization you can assign the store to the document object:
document.sveltestore = mystore;
this will work for svelte 1 & 2
Upvotes: 2