mirror of
https://github.com/moparisthebest/mail
synced 2024-10-31 15:25:01 -04:00
26 lines
695 B
JavaScript
26 lines
695 B
JavaScript
|
define(function(require) {
|
||
|
'use strict';
|
||
|
|
||
|
var cfg = require('js/app-config').config;
|
||
|
|
||
|
var self = {};
|
||
|
|
||
|
self.create = function(options, callback) {
|
||
|
if (window.chrome && chrome.notifications) {
|
||
|
chrome.notifications.create(options.id, {
|
||
|
type: 'basic',
|
||
|
title: options.title,
|
||
|
message: options.message,
|
||
|
iconUrl: chrome.runtime.getURL(cfg.iconPath)
|
||
|
}, callback);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
self.setOnClickedListener = function(listener) {
|
||
|
if (window.chrome && chrome.notifications) {
|
||
|
chrome.notifications.onClicked.addListener(listener);
|
||
|
}
|
||
|
};
|
||
|
|
||
|
return self;
|
||
|
});
|