@nextcloud/notify_push
Advanced tools
+6
-0
@@ -12,2 +12,8 @@ declare global { | ||
| /** | ||
| * Get the list of supported notification types as reported by the server | ||
| * | ||
| * @return string[] | ||
| */ | ||
| export declare function getSupportedTypes(): string[]; | ||
| /** | ||
| * Register a listener for notify_push events | ||
@@ -14,0 +20,0 @@ * |
+25
-2
@@ -39,3 +39,3 @@ "use strict"; | ||
| Object.defineProperty(exports, "__esModule", { value: true }); | ||
| exports.listen = void 0; | ||
| exports.listen = exports.getSupportedTypes = void 0; | ||
| var capabilities_1 = require("@nextcloud/capabilities"); | ||
@@ -45,2 +45,17 @@ var axios_1 = require("@nextcloud/axios"); | ||
| /** | ||
| * Get the list of supported notification types as reported by the server | ||
| * | ||
| * @return string[] | ||
| */ | ||
| function getSupportedTypes() { | ||
| var capabilities = capabilities_1.getCapabilities(); | ||
| if (capabilities.notify_push) { | ||
| return capabilities.notify_push.type; | ||
| } | ||
| else { | ||
| return []; | ||
| } | ||
| } | ||
| exports.getSupportedTypes = getSupportedTypes; | ||
| /** | ||
| * Register a listener for notify_push events | ||
@@ -58,3 +73,8 @@ * | ||
| window._notify_push_listeners[name].push(handler); | ||
| setupSocket(); | ||
| if (window._notify_push_ws !== null && typeof window._notify_push_ws === "object") { | ||
| window._notify_push_ws.send('listen ' + name); | ||
| } | ||
| else { | ||
| setupSocket(); | ||
| } | ||
| return window._notify_push_available; | ||
@@ -104,2 +124,5 @@ } | ||
| window._notify_push_ws.send(response.data); | ||
| for (var name_1 in window._notify_push_listeners) { | ||
| window._notify_push_ws.send('listen ' + name_1); | ||
| } | ||
| } | ||
@@ -106,0 +129,0 @@ }; |
+25
-1
@@ -15,2 +15,17 @@ import { getCapabilities } from '@nextcloud/capabilities'; | ||
| /** | ||
| * Get the list of supported notification types as reported by the server | ||
| * | ||
| * @return string[] | ||
| */ | ||
| export function getSupportedTypes(): string[] { | ||
| const capabilities = getCapabilities() as Capabilities; | ||
| if (capabilities.notify_push) { | ||
| return capabilities.notify_push.type | ||
| } else { | ||
| return []; | ||
| } | ||
| } | ||
| /** | ||
| * Register a listener for notify_push events | ||
@@ -30,3 +45,7 @@ * | ||
| window._notify_push_listeners[name].push(handler); | ||
| setupSocket(); | ||
| if (window._notify_push_ws !== null && typeof window._notify_push_ws === "object") { | ||
| window._notify_push_ws.send('listen ' + name); | ||
| } else { | ||
| setupSocket(); | ||
| } | ||
@@ -56,2 +75,3 @@ return window._notify_push_available; | ||
| notify_push?: { | ||
| type: string[], | ||
| endpoints: { | ||
@@ -86,2 +106,6 @@ pre_auth: string, | ||
| window._notify_push_ws.send(response.data) | ||
| for (let name in window._notify_push_listeners) { | ||
| window._notify_push_ws.send('listen ' + name); | ||
| } | ||
| } | ||
@@ -88,0 +112,0 @@ } |
+1
-1
| { | ||
| "name": "@nextcloud/notify_push", | ||
| "version": "1.0.1", | ||
| "version": "1.1.0", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
+2
-2
@@ -1,4 +0,4 @@ | ||
| # @nextcloud/event-bus | ||
| # @nextcloud/notify_push | ||
| [](https://www.npmjs.com/package/@nextcloud/notify_push) | ||
| [](https://www.npmjs.com/package/@nextcloud/notify_push) | ||
@@ -5,0 +5,0 @@ A javascript client for notify_push events for Nextcloud apps. |
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
Network access
Supply chain riskThis module accesses the network.
Found 1 instance in 1 package
216339
0.7%2816
1.81%