@openfin/web-notifications 2.9.1-alpha-3944
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/README.md +55 -0
- package/dist/web/index.d.ts +1548 -0
- package/dist/web/index.js +2927 -0
- package/package.json +54 -0
package/README.md
ADDED
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
<!-- README for NPM; the one for GitHub is in .github directory. -->
|
|
2
|
+
|
|
3
|
+
# Here™ Web Notification Center
|
|
4
|
+
|
|
5
|
+
## Overview
|
|
6
|
+
|
|
7
|
+
The **Here™ Web Notification Center** offers a consistent and streamlined way for developers to create, display, and manage desktop notifications. It also supports handling notification events seamlessly within a web browser.
|
|
8
|
+
|
|
9
|
+
All notifications are displayed, categorized, and managed within a centralized Notification Center UI.
|
|
10
|
+
|
|
11
|
+
## Getting Started
|
|
12
|
+
|
|
13
|
+
To integrate the Notification Center into your application, install the Here™ Web Notification Center package.
|
|
14
|
+
|
|
15
|
+
### Import the Web Notification Center
|
|
16
|
+
|
|
17
|
+
```bash
|
|
18
|
+
npm install @openfin/web-notifications
|
|
19
|
+
```
|
|
20
|
+
|
|
21
|
+
### Set Up the Core-Web Fin Context
|
|
22
|
+
|
|
23
|
+
Before using the Notification Center, ensure your application is configured with a `fin` context from the `@openfin/core-web` package.
|
|
24
|
+
This context provides the necessary runtime connection and environment information.
|
|
25
|
+
|
|
26
|
+
For setup instructions, refer to the [@openfin/core-web](https://www.npmjs.com/package/@openfin/core-web) documentation.
|
|
27
|
+
|
|
28
|
+
### Usage
|
|
29
|
+
|
|
30
|
+
Add a container `<div>` in your HTML with a specific ID (e.g., `id="notification_center_container"`).
|
|
31
|
+
|
|
32
|
+
> **Note:** The Notification Center UI is optimized for containers that are 345px wide.
|
|
33
|
+
|
|
34
|
+
Initialize the Notification Center by importing the module and passing in the required options, including the `finContext`, `serviceId`, and the container element.
|
|
35
|
+
The `serviceId` will be used by the client library to connect to the notification service.
|
|
36
|
+
Optional parameters such as a custom theme or a session snapshot can also be provided.
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
import { initiNotificationCenter } from '@openfin/web-notifications';
|
|
40
|
+
|
|
41
|
+
const notificationCenterContainer = document.querySelector<HTMLElement>(
|
|
42
|
+
'#notification_center_container'
|
|
43
|
+
);
|
|
44
|
+
|
|
45
|
+
// initialize fin context.
|
|
46
|
+
|
|
47
|
+
// initialize the notification center.
|
|
48
|
+
await initNotificationCenter({
|
|
49
|
+
finContext: fin,
|
|
50
|
+
serviceId: 'notification-center-service-channel',
|
|
51
|
+
container: notificationCenterContainer,
|
|
52
|
+
theme: myTheme,
|
|
53
|
+
snapshot: myPreviousSessionSnapshot
|
|
54
|
+
});
|
|
55
|
+
```
|