@enonic-types/lib-notifications
v3.0.2
Published
Type definitions for the Enonic XP Notifications library
Readme
lib-notifications TS types
Type definitions for the Enonic XP Notifications library.
Install
npm i --save-dev @enonic-types/lib-notificationsUse
Add the corresponding types to your tsconfig.json file that is used for application's server-side TypeScript code:
{
"compilerOptions": {
"paths": {
"/lib/notifications": ["./node_modules/@enonic-types/lib-notifications"],
},
}
}Example
import {generateKeyPair, send} from '/lib/notifications';
const keyPair = generateKeyPair();
const status = send({
publicKey: keyPair.publicKey,
privateKey: keyPair.privateKey,
endpoint: subscription.endpoint,
auth: subscription.auth,
receiverKey: subscription.receiverKey,
payload: {message: 'Hello!'},
});