909 B
909 B
| sidebar_position | title |
|---|---|
| 2 | events |
events lets you receive events about actions that take place in the app, like when a user sends a new message.
You can then implement custom logic handlers for such events.
Usage
import { events } from "@janhq/core";
EventName
The EventName enum bundles the following events:
OnNewConversationOnNewMessageRequestOnNewMessageResponseOnMessageResponseUpdateOnDownloadUpdateOnDownloadSuccessOnDownloadError
event.on
Adds an observer for an event.
const on: (eventName: string, handler: Function) => void = (eventName, handler);
event.emit
Emits an event.
const emit: (eventName: string, object: any) => void = (eventName, object);
event.off
Removes an observer for an event.
const off: (eventName: string, handler: Function) => void =
(eventName, handler);