@vocalime/jovo-standard-events-plugin
v2.0.2
Published
Handle standard events outside your components.
Downloads
6
Readme
Welcome to Jovo Standard Events Plugin 👋
Handle standard events outside your components.
🏠 Homepage
Install
npm install @vocalime/jovo-standard-events-plugin
Example
index.js
import { StandardEventPlugin } from '@vocalime/jovo-standard-events-plugin';
import { App } from '@jovotech/framework';
import {
newUser,
newSession,
onRequest,
onResponse,
} from './standard-event-handlers';
export const app = new App({
components: [
// Your components
],
plugins: [
// Other plugins...,
new StandardEventsPlugin({
newUserHandlers: [newUser],
newSessionHandlers: [newSession],
onRequestHandlers: [onRequest],
onResponseHandlers: [onResponse],
}),
],
});
standard-event-handlers.ts
import { Jovo } from '@jovotech/framework';
export async function newUser(jovo: Jovo): Promise<void> {
console.log('This function runs the first time the user invokes your app.');
}
export async function newSession(jovo: Jovo): Promise<void> {
console.log('This function runs once per session.');
}
export async function onRequest(jovo: Jovo): Promise<void> {
console.log('This function runs once per request after deserializing the request from JSON.');
}
export async function onResponse(jovo: Jovo): Promise<void> {
console.log('This function runs once per request before serializing the response to JSON.');
}
Author
👤 Vocalime
- Website: www.vocalime.com
- Github: @vocalime-base
- Linkedin: @vocalime
Show your support
Give a ⭐️ if this project helped you!
📝 License
Copyright © 2022 vocalime.
This project is MIT licensed.