soundyogi soundyogi - 5 months ago 41
Javascript Question

chrome-devtools snippets import/export 2016

Today I wanted to export my snippets from chrome.

I found Information from 2013:
https://github.com/bgrins/devtools-snippets/issues/28#issuecomment-27455522

I opened the DevTools
-> to sperate Window
-> Inspect the Devtools Itself

Then in Console:

->localStorage.scriptSnippets
undefined
->var stringifiedSnippets = localStorage.getItem('scriptSnippets');
undefined
->stringifiedSnippets
null


I tested Chrome 48 (windows), Chromium 45(ubuntu) and a Friends Chrome on his Macbook.
How can I access my Snippets.

Has the API changed? Or am I making a mistake here.
Thanks.

Answer

Yes, the internals have changed. Your code should change to the following:

InspectorFrontendHost.getPreferences(function(prefs) {
    console.log(prefs.scriptSnippets);
});
Comments