Handle standard events outside your components.
🏠 Homepage
npm install @vocalime/jovo-standard-events-plugin
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],
}),
],
});
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.');
}
👤 Vocalime
- Website: www.vocalime.com
- Github: @vocalime-base
- Linkedin: @vocalime
Give a ⭐️ if this project helped you!
Copyright © 2022 vocalime.
This project is MIT licensed.