node-webpush 1.0.1 → 1.0.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +5 -5
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -58,7 +58,7 @@ that can be sent with Node’s built-in `fetch()`.
|
|
|
58
58
|
> (Adjust package name once published)
|
|
59
59
|
|
|
60
60
|
```bash
|
|
61
|
-
npm install
|
|
61
|
+
npm install node-webpush
|
|
62
62
|
````
|
|
63
63
|
|
|
64
64
|
TypeScript is supported out of the box (the package emits `.d.ts`).
|
|
@@ -70,7 +70,7 @@ TypeScript is supported out of the box (the package emits `.d.ts`).
|
|
|
70
70
|
### 1) Create a `WebPush` instance
|
|
71
71
|
|
|
72
72
|
```ts
|
|
73
|
-
import {WebPush} from "
|
|
73
|
+
import {WebPush} from "node-webpush";
|
|
74
74
|
|
|
75
75
|
const webpush = new WebPush({
|
|
76
76
|
vapid: {
|
|
@@ -106,7 +106,7 @@ console.log("Status:", res.status);
|
|
|
106
106
|
## Generate VAPID keys
|
|
107
107
|
|
|
108
108
|
```ts
|
|
109
|
-
import {VAPID} from "
|
|
109
|
+
import {VAPID} from "node-webpush";
|
|
110
110
|
|
|
111
111
|
const keys = VAPID.GenerateKeys();
|
|
112
112
|
console.log(keys.publicKey);
|
|
@@ -235,7 +235,7 @@ await webpush.sendNotification(subscription, "hello", {
|
|
|
235
235
|
## Minimal example with manual fetch
|
|
236
236
|
|
|
237
237
|
```ts
|
|
238
|
-
import {WebPush} from "
|
|
238
|
+
import {WebPush} from "node-webpush";
|
|
239
239
|
|
|
240
240
|
const webpush = new WebPush({
|
|
241
241
|
vapid: {
|
|
@@ -261,7 +261,7 @@ console.log(res.status);
|
|
|
261
261
|
## Error handling
|
|
262
262
|
|
|
263
263
|
```ts
|
|
264
|
-
import {WebPush, WebPushError} from "
|
|
264
|
+
import {WebPush, WebPushError} from "node-webpush";
|
|
265
265
|
|
|
266
266
|
try {
|
|
267
267
|
await webpush.sendNotification(subscription, "hello");
|