Licence
SEE LICENSE IN license.txt
Version
15.101.0
Deps
3
Size
345 kB
Vulns
0
Weekly
18.2K
@genesislcap/foundation-notifications
Documentation for this package is published on the Genesis docs site:
Docs: Toast notifications
Installation
Add the package to your package.json dependencies. After changing dependencies, run npm run bootstrap (or your project's equivalent). See package.json basics for more information.
{
"dependencies": {
"@genesislcap/foundation-notifications": "latest"
}
}
Service Worker Desktop Notifications
This package exports registerDesktopNotificationHandlers from @genesislcap/foundation-notifications/service-worker to handle OS desktop notifications in an application's service worker:
// sw.js
import { registerDesktopNotificationHandlers } from '@genesislcap/foundation-notifications/service-worker';
registerDesktopNotificationHandlers({
tagPrefix: 'genesis-alert-',
findMainWindow: (windows) => windows.find((w) => !new URL(w.url).searchParams.has('component')),
});
The service worker:
- shows OS desktop notifications for alerts arriving while no window of the app is visible;
- updates the application dock badge (
setAppBadge/clearAppBadge) with the count of active alerts, including after one is dismissed; - clears all alert notifications and the dock badge when any window of the app returns to view;
- focuses the main window (or opens one at the service worker's scope) when an alert notification is clicked.
License
Note: this project provides front-end dependencies and uses licensed components listed in the next section; thus, licenses for those components are required during development. Contact Genesis Global for more details.
Licensed components
Genesis low-code platform