Skip to content

Instantly share code, notes, and snippets.

@lv7777
Created December 10, 2015 12:48
Show Gist options
  • Save lv7777/9d2bee70b198d569e688 to your computer and use it in GitHub Desktop.
Save lv7777/9d2bee70b198d569e688 to your computer and use it in GitHub Desktop.
webextension解説2回め。
chrome.runtime.onMessage.addListener(notify);
console.log("background")
function notify(message) {
console.log("background script received message");
/* chrome.notifications.create({
"type": "basic",
"iconUrl": chrome.extension.getURL("link.png"),
"title": "You clicked a link!",
"message": message.url
});
*/
//リスナーの追加
chrome.alarms.onAlarm.addListener(eventhacker);
chrome.alarms.create("helloworld",{ delayInMinutes: 5 })
}
//このメソッドはギャグですので使用時にはご注意下さい。
function eventhacker(alarmobj){
console.log("alarm catched");
console.log(alarmobj);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment