做网站|网站建设,就上易助科技网

前端技术文档及相关资料下载

关于前端html、css、js等技术上的各种疑难棘手问题的解决方案探讨及相关资料下载!

JS跨浏览器的桌面通知插件Push.js
来源:易助科技网浏览量:1收藏

简介

Push.js是一款跨浏览器的桌面通知插件,如果用户的浏览器不支持,则返回使用旧的实现。推送是启动和运行Javascript桌面通知的最快方式。作为官方规范的一个新添加,NotificationAPI允许Chrome、Safari、Firefox和IE 9+等现代浏览器将通知推送到用户的桌面。Push作为该API的跨浏览器解决方案,如果用户的浏览器不支持新的API,则返回使用旧的实现。

世界上最通用的桌面通知框架达。

 


使用

1.  引入 Push.js 文件


2.  简单使用

创建使用:

Push.create('Hello World!')

define(['pushjs'], function (Push) {
Push.create('Hello World!');
});

Push.count();

关闭通知:

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();


相关链接

官网地址 :https://pushjs.org/#

GitHub 地址 :https://github.com/Nickersoft/push.js

Gitee 地址:https://gitee.com/mirrors/push-js