授权 | 开源 |
大小 | 270.86KB |
语言 | JavaScript |
iNotify.js主要是调用 Chrome、Firefox、Safari 等浏览器提供的系统通知 API,实现浏览器系统通知,实现 title 标签 闪烁、滚动、声音提示。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();
相关软件