Push Notification Api

免费增值
通过 TeamsDevBot | 已更新 לפני חודש | Advertising
Health Check

N/A

README


> ~~## How to setup frontend web app too which your visitors will subscribe?
~~


- [ ] **Steps**

1. Add SW.js file to your public folder.
2. Add these code in header app.
`<script>
        navigator.serviceWorker.register("sw.js");

        function enableNotif() {
            Notification.requestPermission().then((permission)=> {
                if (permission === 'granted') {
                    // get service worker
                    navigator.serviceWorker.ready.then((sw)=> {
                        // subscribe
                        sw.pushManager.subscribe({
                            userVisibleOnly: true,
                            applicationServerKey: "these code will generate for you"
                        }).then((subscription)=> {
                            console.log(JSON.stringify(subscription));
                         
                        });
                    });
                }
            });
        }
    </script>`







关注者:0
API 创建者:
Rapid account: Teams Dev Bot
TeamsDevBot
teamsdevbot
登录并给 API 打分
打分:5 - 投票:1