iNotify.js浏览器系统通知插件 v2.1.0

iNotify.js主要是调用 Chrome、Firefox、Safari 等浏览器提供的系统通知 API,实现浏览器系统通知,实现 title 标签 闪烁、滚动、声音提示。favicon 图标数字信息通知,声音播放等.....


结构

message: String 标题
effect: String, flash | scroll | favicon 闪烁还是滚动
audio: 可选播放声音
  file: String/Array 可以使用数组传多种格式的声音文件
interval: Number 标题闪烁,或者滚动速度
openurl: String 点击弹窗打开连接地址
onclick: Function 弹窗点击事件
updateFavicon: 设置 Favicon 图标颜色
  textColor: 设置 favicon 字体颜色
  backgroundColor: 背景颜色,设置背景颜色透明,将值设置为 transparent
notification: 可选 chrome 浏览器通知,默认不填写就是下面的内容
  title: 默认值 通知!
  icon: 设置图标 icon 默认为 Favicon

  body: 设置消息内容


例子

实例一
function iconNotify(num) {
  if (!notify) {
    var notify = new Notify({
      effect: "flash",
      interval: 500,
    });
  }
  if (num === 0) {
    notify.faviconClear();
    notify.setTitle();
  } else if (num < 100) {
    notify.setFavicon(num);
    notify.setTitle("有新消息!");
  } else if (num > 99) {
    notify.setFavicon("..");
    notify.setTitle("有新消息!");
  }
}
实例二

var notify = new Notify({
  effect: "flash",
  interval: 500,
});
notify.setFavicon("1");

实例三

var iN = new Notify({
  effect: "flash",
  interval: 500,
  message: "有消息拉!",
  updateFavicon: {
    // 可选,默认绿底白字
    textColor: "#fff", // favicon 字体颜色
    backgroundColor: "#2F9A00", // 背景颜色
  },
}).setFavicon(10);

实例四

var iN = new Notify().setFavicon(5);

实例五

var iN = new Notify({
  effect: "flash",
  interval: 500,
  message: "有消息拉!",
  audio: {
    file: "msg.mp4",
  },
})
  .setFavicon(10)
  .player();

实例六

var iN = new Notify({
  effect: "flash",
  interval: 500,
  message: "有消息拉!",
  audio: {
    file: ["msg.mp4", "msg.mp3", "msg.wav"],
  },
  notification: {
    title: "通知!",
    body: "您来了一条新消息",
  },
});

iN.setFavicon(10).player();

var n = new Notify();
n.init({
  effect: "flash",
  interval: 500,
  message: "有消息拉!",
  audio: {
    file: ["openSub.mp4", "openSub.mp3", "openSub.wav"],
  },
  notification: {
    title: "通知!",
    icon: "",
    body: "您来了一个客户",
  },
});

n.setFavicon(10).player();



iNotify.js浏览器系统通知插件
下载列表

版权声明:本文来源于互联网,如有侵权,请联系下方邮箱,一个工作日删除!