@interopio/browser-worker 4.1.1-beta.0 → 4.2.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/LICENSE +21 -21
- package/dist/web.worker.es.js.map +1 -1
- package/dist/web.worker.umd.js.map +1 -1
- package/package.json +2 -2
- package/readme.md +18 -18
- package/web.worker.d.ts +26 -26
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@interopio/browser-worker",
|
|
3
|
-
"version": "4.
|
|
3
|
+
"version": "4.2.0",
|
|
4
4
|
"main": "dist/web.worker.umd.js",
|
|
5
5
|
"module": "dist/web.worker.es.js",
|
|
6
6
|
"types": "./web.worker.d.ts",
|
|
@@ -36,5 +36,5 @@
|
|
|
36
36
|
"dist",
|
|
37
37
|
"web.worker.d.ts"
|
|
38
38
|
],
|
|
39
|
-
"gitHead": "
|
|
39
|
+
"gitHead": "1805933707f7317dc5e0ccb540c2eabd9225ccef"
|
|
40
40
|
}
|
package/readme.md
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
# IO Connect Browser Service Worker Module
|
|
2
|
-
|
|
3
|
-
## Overview
|
|
4
|
-
|
|
5
|
-
@interopio/browser-worker is a library, which is designed to be imported into a service worker file. The library enables the advanced notifications functionality of IO Connect Browser, which requires a Service Worker.
|
|
6
|
-
|
|
7
|
-
## Getting Started
|
|
8
|
-
|
|
9
|
-
The package can be added to a service worker file in two ways. One is by using the `importScripts()` method attached to the `self` global object in the Service Worker scope. The library will then define and attach to the `self` object a number of stateless functions.
|
|
10
|
-
|
|
11
|
-
The other way is to import the package just like any other JS package in your existing service worker project. Then you can build it and the output should be a single .js file, ready to be registered as a service worker.
|
|
12
|
-
|
|
13
|
-
## Usage
|
|
14
|
-
|
|
15
|
-
The library gives access to three functions:
|
|
16
|
-
- self.IOWorker or default export - this function initializes the package and registers the necessary event listeners to correctly capture and process notification clicks
|
|
17
|
-
- self.openBrowserPlatform or {openBrowserPlatform} - this function accepts a url and will open and wait for the platform app to be fully operational
|
|
18
|
-
- self.raiseIONotification or {raiseIONotification} - this function accepts a IO Connect Browser notification settings object and will raise the notification.
|
|
1
|
+
# IO Connect Browser Service Worker Module
|
|
2
|
+
|
|
3
|
+
## Overview
|
|
4
|
+
|
|
5
|
+
@interopio/browser-worker is a library, which is designed to be imported into a service worker file. The library enables the advanced notifications functionality of IO Connect Browser, which requires a Service Worker.
|
|
6
|
+
|
|
7
|
+
## Getting Started
|
|
8
|
+
|
|
9
|
+
The package can be added to a service worker file in two ways. One is by using the `importScripts()` method attached to the `self` global object in the Service Worker scope. The library will then define and attach to the `self` object a number of stateless functions.
|
|
10
|
+
|
|
11
|
+
The other way is to import the package just like any other JS package in your existing service worker project. Then you can build it and the output should be a single .js file, ready to be registered as a service worker.
|
|
12
|
+
|
|
13
|
+
## Usage
|
|
14
|
+
|
|
15
|
+
The library gives access to three functions:
|
|
16
|
+
- self.IOWorker or default export - this function initializes the package and registers the necessary event listeners to correctly capture and process notification clicks
|
|
17
|
+
- self.openBrowserPlatform or {openBrowserPlatform} - this function accepts a url and will open and wait for the platform app to be fully operational
|
|
18
|
+
- self.raiseIONotification or {raiseIONotification} - this function accepts a IO Connect Browser notification settings object and will raise the notification.
|
package/web.worker.d.ts
CHANGED
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
-
export interface IOConnectNotificationClickHandler {
|
|
3
|
-
handler: (event: Event, isPlatformOpened: boolean) => Promise<void>;
|
|
4
|
-
action: string;
|
|
5
|
-
}
|
|
6
|
-
|
|
7
|
-
export interface WebWorkerConfig {
|
|
8
|
-
platform?: {
|
|
9
|
-
url?: string;
|
|
10
|
-
openIfMissing?: boolean;
|
|
11
|
-
};
|
|
12
|
-
notifications?: {
|
|
13
|
-
defaultClick?: (event: Event, isPlatformOpened: boolean) => Promise<void>;
|
|
14
|
-
actionClicks?: IOConnectNotificationClickHandler[];
|
|
15
|
-
};
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export type IOConnectWebWorkerFactoryFunction = (config?: WebWorkerConfig) => void;
|
|
19
|
-
export type OpenCorePlatform = (url: string) => Promise<void>;
|
|
20
|
-
export type RaiseIONotification = (settings: any) => Promise<void>;
|
|
21
|
-
|
|
22
|
-
declare const IOWorkerFactory: IOConnectWebWorkerFactoryFunction;
|
|
23
|
-
|
|
24
|
-
export const openBrowserPlatform: OpenCorePlatform;
|
|
25
|
-
export const raiseIONotification: RaiseIONotification;
|
|
26
|
-
|
|
1
|
+
/* eslint-disable @typescript-eslint/no-explicit-any */
|
|
2
|
+
export interface IOConnectNotificationClickHandler {
|
|
3
|
+
handler: (event: Event, isPlatformOpened: boolean) => Promise<void>;
|
|
4
|
+
action: string;
|
|
5
|
+
}
|
|
6
|
+
|
|
7
|
+
export interface WebWorkerConfig {
|
|
8
|
+
platform?: {
|
|
9
|
+
url?: string;
|
|
10
|
+
openIfMissing?: boolean;
|
|
11
|
+
};
|
|
12
|
+
notifications?: {
|
|
13
|
+
defaultClick?: (event: Event, isPlatformOpened: boolean) => Promise<void>;
|
|
14
|
+
actionClicks?: IOConnectNotificationClickHandler[];
|
|
15
|
+
};
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
export type IOConnectWebWorkerFactoryFunction = (config?: WebWorkerConfig) => void;
|
|
19
|
+
export type OpenCorePlatform = (url: string) => Promise<void>;
|
|
20
|
+
export type RaiseIONotification = (settings: any) => Promise<void>;
|
|
21
|
+
|
|
22
|
+
declare const IOWorkerFactory: IOConnectWebWorkerFactoryFunction;
|
|
23
|
+
|
|
24
|
+
export const openBrowserPlatform: OpenCorePlatform;
|
|
25
|
+
export const raiseIONotification: RaiseIONotification;
|
|
26
|
+
|
|
27
27
|
export default IOWorkerFactory;
|