# browser-notice
**Repository Path**: github-9819409/browser-notice
## Basic Information
- **Project Name**: browser-notice
- **Description**: 浏览器通知方法封装
- **Primary Language**: Unknown
- **License**: Not specified
- **Default Branch**: master
- **Homepage**: None
- **GVP Project**: No
## Statistics
- **Stars**: 0
- **Forks**: 0
- **Created**: 2021-04-21
- **Last Updated**: 2021-09-29
## Categories & Tags
**Categories**: Uncategorized
**Tags**: None
## README
# **浏览器通知方法封装**
> 为了使用浏览器通知方法更加便利,对浏览器通知方法进行封装
## **使用步骤**
### **STEP1 安装模块**
``` bash
npm install browser-notice --save
```
### **STEP2 引入并使用模块**
> 模块支持commonjs和AMD二种规范,同时也支持通过ES module方式使用
``` js
import Notice from 'browser-notice';
// let Notice = require("browser-notice");
Notice.show({
title: "温馨提示", // 通知标题
body: "这是温馨提示的内容", // 通知文字内容
icon: "图标链接", // 远程图片地址,或者转为base64的图片
// 点击回调
click(){
console.log("click");
},
// 通知弹出成功回调
success() {
console.log("show");
},
// 通知弹窗错误回调
error(err) {
console.log(err);
}
})
```
消息通知示例展示如下:

注:此方法只支持部分浏览器,兼容情况见如下MDN文挡说明
[MDN文挡参考链接](https://developer.mozilla.org/zh-CN/docs/Web/API/notification "notification")