@openfin/node-adapter 43.100.63 → 43.100.64
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/out/node-adapter.js +90 -1
- package/package.json +2 -2
package/out/node-adapter.js
CHANGED
@@ -17014,7 +17014,24 @@ var _NotificationManagerInstance_wire, _NotificationManagerInstance_handler, _No
|
|
17014
17014
|
Object.defineProperty(instance, "__esModule", { value: true });
|
17015
17015
|
instance.NotificationManagerInstance = void 0;
|
17016
17016
|
const lazy_1 = lazy;
|
17017
|
+
/**
|
17018
|
+
* NotificationManagers allow all {@link https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API | HTML5 notifications} created in the application to be intercepted and dispatched.
|
17019
|
+
*
|
17020
|
+
* Please note, currently Notifications will only be intercepted if the following conditions are met:
|
17021
|
+
* - The source WebContents has the `notification` webAPI permission.
|
17022
|
+
* - The source WebContents is not a service worker.
|
17023
|
+
*
|
17024
|
+
* Service worker and push notifications are currently not supported.
|
17025
|
+
*
|
17026
|
+
* **See also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notifications_API | Notification API (MDN)}
|
17027
|
+
*
|
17028
|
+
* @experimental This API is subject to change in future releases.
|
17029
|
+
*
|
17030
|
+
*/
|
17017
17031
|
class NotificationManagerInstance {
|
17032
|
+
/**
|
17033
|
+
* @internal
|
17034
|
+
*/
|
17018
17035
|
constructor(wire, id) {
|
17019
17036
|
_NotificationManagerInstance_wire.set(this, void 0);
|
17020
17037
|
_NotificationManagerInstance_handler.set(this, void 0);
|
@@ -17044,13 +17061,60 @@ class NotificationManagerInstance {
|
|
17044
17061
|
});
|
17045
17062
|
return true;
|
17046
17063
|
}));
|
17064
|
+
/**
|
17065
|
+
* Sets the current handler for notifications. The provided function will be invoked whenever a WebContents successfully raises a notification.
|
17066
|
+
*
|
17067
|
+
* **Note**, only one handler can be used at a time, calling `setNotificationHandler` will replace any existing registered handler.
|
17068
|
+
*
|
17069
|
+
* @param handler The notification handler callback which will be invoked whenever a notification is created.
|
17070
|
+
*
|
17071
|
+
* @example
|
17072
|
+
*
|
17073
|
+
* ```typescript
|
17074
|
+
* const notificationManager = await fin.NotificationManager.init();
|
17075
|
+
* const handler = (notification) => {
|
17076
|
+
* console.log("Received the following notification", info);
|
17077
|
+
* }
|
17078
|
+
* await notificationManager.setNotificationHandler(handler);
|
17079
|
+
* ```
|
17080
|
+
*/
|
17047
17081
|
this.setNotificationHandler = async (handler) => {
|
17048
17082
|
await __classPrivateFieldGet$1(this, _NotificationManagerInstance_isReceivingNotifications, "f").getValue();
|
17049
17083
|
__classPrivateFieldSet$1(this, _NotificationManagerInstance_handler, handler, "f");
|
17050
17084
|
};
|
17085
|
+
/**
|
17086
|
+
* Destroys the current NotificationManagerInstance.
|
17087
|
+
*
|
17088
|
+
* @example
|
17089
|
+
* ```typescript
|
17090
|
+
* await notificationManager.destroy();
|
17091
|
+
* ```
|
17092
|
+
*/
|
17051
17093
|
this.destroy = async () => {
|
17052
17094
|
await __classPrivateFieldGet$1(this, _NotificationManagerInstance_wire, "f").sendAction('destroy-notification-manager', { managerId: __classPrivateFieldGet$1(this, _NotificationManagerInstance_id, "f") });
|
17053
17095
|
};
|
17096
|
+
/**
|
17097
|
+
* Dispatches a Notification lifecycle event ('close' | 'click' | 'show').
|
17098
|
+
*
|
17099
|
+
* @param event Identifies the type of event to emit, and which `notificationId` to emit it for.
|
17100
|
+
*
|
17101
|
+
* @example
|
17102
|
+
* ```typescript
|
17103
|
+
* notificationManager.setNotificationHandler((notification) => {
|
17104
|
+
* await mockNotificationUi.showNotification(notification);
|
17105
|
+
* await notificationManager.dispatchNotificationEvent({
|
17106
|
+
* notificationId: notification.notificationId,
|
17107
|
+
* type: 'show
|
17108
|
+
* })
|
17109
|
+
* })
|
17110
|
+
* ```
|
17111
|
+
*
|
17112
|
+
* **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/click_event | Notification Click Event (MDN)}
|
17113
|
+
*
|
17114
|
+
* **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/close_event | Notification Close Event (MDN)}
|
17115
|
+
*
|
17116
|
+
* **See Also** - {@link https://developer.mozilla.org/en-US/docs/Web/API/Notification/show_event | Notification Show Event (MDN)}
|
17117
|
+
*/
|
17054
17118
|
this.dispatch = async (event) => {
|
17055
17119
|
const { notificationId, type } = event;
|
17056
17120
|
await __classPrivateFieldGet$1(this, _NotificationManagerInstance_wire, "f").sendAction('dispatch-notification-event', {
|
@@ -17072,6 +17136,24 @@ const instance_1 = instance;
|
|
17072
17136
|
class NotificationManagerModule extends base_1.Base {
|
17073
17137
|
constructor() {
|
17074
17138
|
super(...arguments);
|
17139
|
+
/**
|
17140
|
+
* Initializes a NotificationManager for the current application, which allows interception of HTML5 web notifications.
|
17141
|
+
*
|
17142
|
+
* Secured by default, must be called from a WebContents with the NotificationManager.init permission.
|
17143
|
+
*
|
17144
|
+
* Only one NotificationManager can be active at a time, calls to `init` will fail otherwise.
|
17145
|
+
*
|
17146
|
+
* If a WebContents with the NotificationManager active reloads or is closed, it will be possible to create a new one.
|
17147
|
+
*
|
17148
|
+
* @example
|
17149
|
+
*
|
17150
|
+
* ```js
|
17151
|
+
* // From Provider context
|
17152
|
+
* const notificationManager = await fin.NotificationManager.init();
|
17153
|
+
* // NotificationManager is now active and will intercept all incoming notifications.
|
17154
|
+
* ```
|
17155
|
+
* @experimental
|
17156
|
+
*/
|
17075
17157
|
this.init = async () => {
|
17076
17158
|
const { payload: { data: { managerId } } } = await this.wire.sendAction('init-notification-manager');
|
17077
17159
|
const manager = new instance_1.NotificationManagerInstance(this.wire, managerId);
|
@@ -17097,6 +17179,13 @@ factory.NotificationManagerModule = NotificationManagerModule;
|
|
17097
17179
|
for (var p in m) if (p !== "default" && !Object.prototype.hasOwnProperty.call(exports, p)) __createBinding(exports, m, p);
|
17098
17180
|
};
|
17099
17181
|
Object.defineProperty(exports, "__esModule", { value: true });
|
17182
|
+
/**
|
17183
|
+
* Entry point for the OpenFin `NotificationManager` API (`fin.NotificationManager`).
|
17184
|
+
*
|
17185
|
+
* * {@link NotificationManagerModule} contains static initialisation apis to create a {@link NotificationManagerInstance} instance.
|
17186
|
+
*
|
17187
|
+
* @packageDocumentation
|
17188
|
+
*/
|
17100
17189
|
__exportStar(factory, exports);
|
17101
17190
|
__exportStar(instance, exports);
|
17102
17191
|
} (notificationManager));
|
@@ -17910,7 +17999,7 @@ class NodeEnvironment extends BaseEnvironment_1 {
|
|
17910
17999
|
};
|
17911
18000
|
}
|
17912
18001
|
getAdapterVersionSync() {
|
17913
|
-
return "43.100.
|
18002
|
+
return "43.100.64";
|
17914
18003
|
}
|
17915
18004
|
observeBounds(element, onChange) {
|
17916
18005
|
throw new Error('Method not implemented.');
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@openfin/node-adapter",
|
3
|
-
"version": "43.100.
|
3
|
+
"version": "43.100.64",
|
4
4
|
"description": "See README.md",
|
5
5
|
"main": "out/node-adapter.js",
|
6
6
|
"types": "out/node-adapter.d.ts",
|
@@ -24,7 +24,7 @@
|
|
24
24
|
"author": "OpenFin",
|
25
25
|
"dependencies": {
|
26
26
|
"@types/node": "^20.14.2",
|
27
|
-
"@openfin/core": "43.100.
|
27
|
+
"@openfin/core": "43.100.64",
|
28
28
|
"lodash": "^4.17.21",
|
29
29
|
"ws": "^7.3.0"
|
30
30
|
}
|