Created
December 10, 2015 12:48
-
-
Save lv7777/9d2bee70b198d569e688 to your computer and use it in GitHub Desktop.
webextension解説2回め。
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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