@nextcloud/notify_push
Advanced tools
+2
-2
| declare global { | ||
| interface Window { | ||
| _notify_push_listeners: { | ||
| [event: string]: ((string: any) => void)[]; | ||
| [event: string]: ((string: any, any: any) => void)[]; | ||
| }; | ||
@@ -24,2 +24,2 @@ _notify_push_ws: WebSocket | null | true; | ||
| */ | ||
| export declare function listen(name: string, handler: (string: any) => void): boolean; | ||
| export declare function listen(name: string, handler: (string: any, any: any) => void): boolean; |
+8
-4
@@ -127,7 +127,11 @@ "use strict"; | ||
| window._notify_push_ws.onmessage = function (message) { | ||
| var event = message.data; | ||
| var i = message.data.indexOf(' '); | ||
| var _a = i > 0 ? [message.data.slice(0, i), message.data.slice(i + 1)] : [message.data, null], event = _a[0], body = _a[1]; | ||
| if (body) { | ||
| body = JSON.parse(body); | ||
| } | ||
| if (window._notify_push_listeners[event]) { | ||
| for (var _i = 0, _a = window._notify_push_listeners[event]; _i < _a.length; _i++) { | ||
| var cb = _a[_i]; | ||
| cb(event); | ||
| for (var _i = 0, _b = window._notify_push_listeners[event]; _i < _b.length; _i++) { | ||
| var cb = _b[_i]; | ||
| cb(event, body); | ||
| } | ||
@@ -134,0 +138,0 @@ } |
+10
-6
@@ -1,8 +0,8 @@ | ||
| import { getCapabilities } from '@nextcloud/capabilities'; | ||
| import {getCapabilities} from '@nextcloud/capabilities'; | ||
| import axios from '@nextcloud/axios' | ||
| import { subscribe } from '@nextcloud/event-bus' | ||
| import {subscribe} from '@nextcloud/event-bus' | ||
| declare global { | ||
| interface Window { | ||
| _notify_push_listeners: { [event: string] : ((string) => void)[] }, | ||
| _notify_push_listeners: { [event: string]: ((string, any) => void)[] }, | ||
| _notify_push_ws: WebSocket | null | true, | ||
@@ -36,3 +36,3 @@ _notify_push_online: boolean, | ||
| */ | ||
| export function listen(name: string, handler: (string) => void): boolean { | ||
| export function listen(name: string, handler: (string, any) => void): boolean { | ||
| setupGlobals(); | ||
@@ -112,7 +112,11 @@ | ||
| window._notify_push_ws.onmessage = message => { | ||
| const event = message.data; | ||
| const i = message.data.indexOf(' '); | ||
| let [event, body] = i > 0 ? [message.data.slice(0, i), message.data.slice(i + 1)] : [message.data, null]; | ||
| if (body) { | ||
| body = JSON.parse(body); | ||
| } | ||
| if (window._notify_push_listeners[event]) { | ||
| for (let cb of window._notify_push_listeners[event]) { | ||
| cb(event); | ||
| cb(event, body); | ||
| } | ||
@@ -119,0 +123,0 @@ } |
+1
-1
| { | ||
| "name": "@nextcloud/notify_push", | ||
| "version": "1.1.0", | ||
| "version": "1.1.1", | ||
| "description": "", | ||
@@ -5,0 +5,0 @@ "main": "dist/index.js", |
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
216811
0.22%2824
0.28%