mirror of
https://github.com/mdn/webextensions-examples.git
synced 2026-04-16 06:18:35 +02:00
14 lines
427 B
JavaScript
14 lines
427 B
JavaScript
chrome.runtime.onMessage.addListener(notify);
|
|
|
|
function notify(message) {
|
|
console.log("background script received message");
|
|
var title = chrome.i18n.getMessage("notificationTitle");
|
|
var content = chrome.i18n.getMessage("notificationContent", message.url);
|
|
chrome.notifications.create({
|
|
"type": "basic",
|
|
"iconUrl": chrome.extension.getURL("icons/link-48.png"),
|
|
"title": title,
|
|
"message": content
|
|
});
|
|
}
|