Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

snippets are no longer available via localStorage #23

Open
paulirish opened this issue Jan 25, 2016 · 6 comments
Open

snippets are no longer available via localStorage #23

paulirish opened this issue Jan 25, 2016 · 6 comments

Comments

@paulirish
Copy link

We made snippets (among other settings) available from incognito. I think this change landed in Chrome stable around 46/47 or so.

As a result, they are no longer available in localStorage. Here's the new technique. These are run from a devtools-on-devtools window.

getting snippets

InspectorFrontendHost.getPreferences(_ => console.log(JSON.parse(_.scriptSnippets)))

setting snippets

InspectorFrontendHost.setPreference("scriptSnippets", JSON.stringify(yourSnippets))

FWIW, InspectorFrontendHost.getPreferences will return everything that has migrated to the incognito-available settings (most things), while a few items (like breakpoints) remain in the devtools' localStorage

Tagging a few other issues that use this technique:

@soundyogi
Copy link

Thanks for the info, helped me tremendously.

I have tried updating the update-code-snippets and started to work on a gui manager script.
Seems to work ok so far:

https://github.com/soundyogi/code-snippets/blob/master/update-code-snippets.js
https://gist.github.com/soundyogi/03df95505604c8351212

I will file a PR when I added support for the old version aswell.

@bahmutov
Copy link
Owner

cool, will update the updater snippet at some point

@cole-gillespie
Copy link

It seems there is no way to map snippets to localSystem. Is mapping snippets to local file system a valid use case or is there something obvious I am missing?

@soundyogi
Copy link

soundyogi commented Aug 14, 2017

Not that I know of, I wrote a little module "require" that required some snippets before others but even for that you need to Inspect the Inspector ... I guess snippets are to sandboxed for local mapping?

@Commandtechno
Copy link

now InspectorFrontendHost is gone as well

@Vijaythepro
Copy link

is there any way of importing snippets now.
InspectorFrontendHost is not defined now

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

6 participants