File tree Expand file tree Collapse file tree 1 file changed +14
-3
lines changed
Expand file tree Collapse file tree 1 file changed +14
-3
lines changed Original file line number Diff line number Diff line change @@ -12,6 +12,17 @@ exports.save = save;
1212exports . load = load ;
1313exports . useColors = useColors ;
1414
15+ /**
16+ * Use chrome.storage.local if we are in an app
17+ */
18+
19+ var storage ;
20+
21+ if ( typeof chrome !== 'undefined' && typeof chrome . storage !== 'undefined' )
22+ storage = chrome . storage . local ;
23+ else
24+ storage = window . localStorage ;
25+
1526/**
1627 * Colors.
1728 */
@@ -118,9 +129,9 @@ function log() {
118129function save ( namespaces ) {
119130 try {
120131 if ( null == namespaces ) {
121- localStorage . removeItem ( 'debug' ) ;
132+ storage . removeItem ( 'debug' ) ;
122133 } else {
123- localStorage . debug = namespaces ;
134+ storage . debug = namespaces ;
124135 }
125136 } catch ( e ) { }
126137}
@@ -135,7 +146,7 @@ function save(namespaces) {
135146function load ( ) {
136147 var r ;
137148 try {
138- r = localStorage . debug ;
149+ r = storage . debug ;
139150 } catch ( e ) { }
140151 return r ;
141152}
You can’t perform that action at this time.
0 commit comments