今天我想从chrome中导出我的代码段。
我从2013年发现信息: https://github.com/bgrins/devtools-snippets/issues/28#issuecomment-27455522
我打开了DevTools - >加速窗口 - >检查Devtools本身
然后在控制台中:
->localStorage.scriptSnippets
undefined
->var stringifiedSnippets = localStorage.getItem('scriptSnippets');
undefined
->stringifiedSnippets
null
我在他的Macbook上测试了Chrome 48(windows),Chromium 45(ubuntu)和Friends Chrome。 如何访问我的代码段。
API有变化吗?或者我在这里犯了一个错误。 感谢。
答案 0 :(得分:3)
是的,内部已经改变了。您的代码应更改为以下内容:
InspectorFrontendHost.getPreferences(function(prefs) {
console.log(prefs.scriptSnippets);
});
答案 1 :(得分:0)
InspectorFrontendHost.getPreferences(function(prefs) {
console.log(prefs.scriptSnippets);
});
此代码在chrome版本51.0.2704.103中完美运行