You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: eventPage.js
+20-10
Original file line number
Diff line number
Diff line change
@@ -6,12 +6,10 @@ initStorage();
6
6
7
7
// init storage engine on load
8
8
functioninitStorage(){
9
-
storage.get('enabled',function(result){
10
-
console.log(result);
11
-
if(typeofresult['enabled']==='undefined'){
9
+
storage.get('enabled',function(result){
10
+
//console.log(result['enabled']);
11
+
if(result['enabled']===undefined){
12
12
enabled=true;
13
-
varnot=webkitNotifications.createNotification('caffeineEnabled.png','Caffeine Enabled!','Your Chromebook now has a good supply of Caffeine and will stay awake forever! (meaning that automatic power management has been disabled) You can always take away the Caffeine (in effect turn back on the automatic power management) by clicking / toggling the Caffeine extension icon.');
14
-
not.show();
15
13
}else{
16
14
enabled=result['enabled'];
17
15
}
@@ -26,27 +24,39 @@ function initStorage() {
26
24
functionsaveStorage(){
27
25
storage.set({'enabled':enabled},function(){console.log('saved in chrome.storage.local: '+enabled);});
28
26
}
27
+
//shows a notification telling the user that Caffeine has been enabled
28
+
functionshowNotification(){
29
+
chrome.notifications.create("welcome",{
30
+
type: "basic",
31
+
iconUrl: "caffeineEnabled.png",
32
+
title: "Caffeine Enabled!",
33
+
message: "Your Chromebook now has a good supply of Caffeine and will stay awake forever! (meaning that automatic power management has been disabled) You can always take away the Caffeine (in effect turn back on the automatic power management) by clicking / toggling the Caffeine extension icon."
34
+
},function(notificationId){
35
+
//callback needs to be included for notifications to work!
console.log('Storage key "%s" in namespace "%s" changed. Old value was: %s, new value is: %s',key,namespace,storageChange.oldValue,storageChange.newValue);
59
+
//console.log('Storage key "%s" in namespace "%s" changed. Old value was: %s, new value is: %s', key, namespace, storageChange.oldValue, storageChange.newValue);
0 commit comments