Commits

ryanackley  committed da7772d

Fixes the config not be loaded on tincr restart

  • Participants
  • Parent commits 78ecad8

Comments (0)

Files changed (4)

File BackgroundMsgSupport.js

 	},
 	clearResource : function(url, callback){
 		chrome.extension.sendRequest({key: 'clearResource', url:url}, callback);
+	},
+	getPreference : function(prefKey, callback){
+		chrome.extension.sendRequest({key:'getPreference', prefKey: prefKey}, callback);
+	},
+	setPreference : function(prefObj, callback){
+		chrome.extension.sendRequest({key: 'setPreference', prefObj: prefObj}, callback);
 	}
 }

File background.js

     else if (request.key == 'clearResource'){
         projectManager.clearResource(sender.tab.id, request.url, sendResponse);
     }
+    else if (request.key == 'getPreference'){
+        chrome.storage.local.get(request.prefKey, sendResponse);
+    }
+    else if (request.key == 'setPreference'){
+        chrome.storage.local.set(request.prefObj, sendResponse);
+    }
     else{
         sendResponse({});
     }
 	var storeData = {};
 	if (projectState.type != 'fileUrl'){
 		storeData[inspectedLocation.origin] = projectState;
-		chrome.storage.local.set(storeData);
+		backgroundMsgSupport.setPreference(storeData, function(){});
 	}
 	else{
 		var temp = {autosave: projectState.autosave, watchFiles: projectState.watchFiles};
 		storeData[inspectedLocation.origin] = temp;
-		chrome.storage.local.set(storeData);
+		backgroundMsgSupport.setPreference(storeData, function(){});
 	}
 }
 
 			if (path.charAt(0) == '/' && navigator.platform.indexOf('Win') == 0){
 				path = path.substring(1);
 			}
-			chrome.storage.local.get(String(location.origin), function(data){
+			backgroundMsgSupport.getPreference(String(location.origin), function(data){
 				temp = data[location.origin] || {autosave: true, watchFiles: true};
 				maybeLoadProject();
 			});
 		}
 		else{
-			chrome.storage.local.get(String(location.origin), function(data){
+			backgroundMsgSupport.getPreference(String(location.origin), function(data){
 				temp = data[location.origin];
 				if (temp){
 					if (temp.type != 'fileUrl'){
 checkLocation();
 //}, 10000);
 
-chrome.storage.local.get('logging', function(data){
+backgroundMsgSupport.getPreference('logging', function(data){
 	toggleLogging(data['logging'] === 'true');
 });
 

File editorpanel.js

         window.devtoolsWindow.saveProjectState();
     });
     $('#toggle-logging').on('change', function(e){
-        chrome.storage.local.set({'logging': this.checked});
+        backgroundMsgSupport.setPreference({'logging': this.checked}, function(){});
         toggleLogging(this.checked);
         devtoolsWindow.toggleLogging(this.checked);
     });