Skip to content

Instantly share code, notes, and snippets.

@goofmint

goofmint/index.js

Created Jul 2, 2018
Embed
What would you like to do?
const icon = `app.png`;
const params = {
title: "プッシュ通知です!",
msg: `これはサーバから送っています. 今は ${new Date().toLocaleString()} です。 メッセージとアイコンも送っています `,
icon: icon
};
Promise.all(subscribers.map(subscription => {
return webpush.sendNotification(subscription, JSON.stringify(params), {});
}))
.then(res => console.log(res))
.catch(err => console.log('ERROR', err));
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment