Push.js跨瀏覽器的桌面通知插件
Push.js,是一款跨瀏覽器的Javascript桌面通知插件。這個通知API允許在當(dāng)下流行的瀏覽器上使用,像Chrome, Safari, Firefox,和IE 9+。可以推送一個通知到用戶桌面。如果用戶的瀏覽器不支持這個新的API,會回滾到使用舊的實現(xiàn)方式。
運行效果:
示例代碼:
創(chuàng)建通知
Push.create('Hello World!')
define(['pushjs'], function (Push) {
Push.create('Hello World!');
});
Push.count();
關(guān)閉通知
Push.create('Hello World!', {
tag: 'foo'
});
// Somewhere later in your code...
Push.close('foo');
var promise = Push.create('Hello World!');
// Somewhere later in your code...
promise.then(function(notification) {
notification.close();
});
Push.clear();評論
圖片
表情
