@livx.cc/native-kit 0.27.0 → 0.28.0
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/package.json +1 -1
- package/src/core/web-adapter.ts +1 -0
- package/src/modules/push.ts +7 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@livx.cc/native-kit",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.28.0",
|
|
4
4
|
"description": "Isomorphic native-capabilities kit for PWAs \u2014 same API in browser and in an appwrap native shell. Zero dependencies.",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"author": "Elya Livshitz",
|
package/src/core/web-adapter.ts
CHANGED
|
@@ -417,6 +417,7 @@ export class WebAdapter implements NativeKitAdapter {
|
|
|
417
417
|
case 'push.requestPermission':
|
|
418
418
|
case 'push.register':
|
|
419
419
|
case 'push.unregister':
|
|
420
|
+
case 'push.sendTest':
|
|
420
421
|
throw new KitError('UNSUPPORTED', 'No native remote push on web — use Web Push (VAPID) in your app, or run inside the appwrap shell');
|
|
421
422
|
|
|
422
423
|
default:
|
package/src/modules/push.ts
CHANGED
|
@@ -65,6 +65,13 @@ export class PushModule {
|
|
|
65
65
|
return this.kit.invoke('push.unregister');
|
|
66
66
|
}
|
|
67
67
|
|
|
68
|
+
/** Dev/demo: ask your backend (via `push.registrationUrl`) to push THIS device on demand. The shell
|
|
69
|
+
* POSTs the token natively (no WebView CORS) with `test:true`. Resolves `{ status }` (the backend's
|
|
70
|
+
* HTTP code). Requires a configured registrationUrl + a registered token. */
|
|
71
|
+
sendTest(): Promise<{ status: number }> {
|
|
72
|
+
return this.kit.invoke('push.sendTest', undefined, { timeoutMs: 20_000 });
|
|
73
|
+
}
|
|
74
|
+
|
|
68
75
|
/** Foreground message delivery (app open, no tap). */
|
|
69
76
|
onMessage(cb: (m: PushMessage) => void): Unsubscribe {
|
|
70
77
|
return this.kit.on('push.message', (p) => cb(p as PushMessage));
|