页面特效 UI组件库 菜单导航 窗口特效 幻灯片滑动 图像相册 表单 选项卡 表格 评分星级 手风琴 文本链接 布局 日历 颜色选择器 按钮 图表 html5 提示 ExtJS 在线客服 其他特效 地图 树形控件 移动开发 BootStrap 滑动条 文件上传 表单验证 分页 播放器 Angular VUE

跨浏览器的Javascript桌面通知插件Push.js

提示 HTML我帮您 1年前  次浏览

Push.js是一个跨浏览器的Javascript桌面通知插件,这个通知插件允许Firefox 22+, Chrome 5+, Safari 6+, Opera 25+, Android Browser 4.4+, Blackberry Browser 10+, Opera Mobile 37+, Firefox Android 47+, and Samsung Internet等浏览器推送通告到用户桌面。

跨浏览器的Javascript桌面通知插件Push.js


Push.create('Hello World!', {
    body: 'This is some body content!',
    icon: {
        x16: 'images/icon-x16.png',
        x32: 'images/icon-x32.png' },
    timeout: 5000 });

Available Options

  • body: The body text of the notification.
  • data: Data to pass to ServiceWorker notifications
  • icon: Can be either the URL to an icon image or an array containing 16x16 and 32x32 pixel icon images (see above).
  • onClick: Callback to execute when the notification is clicked.
  • onClose: Callback to execute when the notification is closed (obsolete).
  • onError: Callback to execute when if the notification throws an error.
  • onShow: Callback to execute when the notification is shown (obsolete).
  • requireInteraction: When set to true, the notification will not close unless the user manually closes or clicks on it.
  • serviceWorker: Path to the service worker script registered on Push mobile. Defaults to "sw.js" if a path is not specified.
  • tag: Unique tag used to identify the notification. Can be used to later close the notification manually.
  • timeout: Time in milliseconds until the notification closes automatically.
  • vibrate: An array of durations for a mobile device receiving the notification to vibrate. For example, [200, 100] would vibrate first for 200 milliseconds, pause, then continue for 100 milliseconds. For more information, see below.


相关链接

发表评论