@vocalime/jovo-standard-events-plugin
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

Welcome to Jovo Standard Events Plugin 👋

Version License: MIT Workflow

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

Show your support

Give a ⭐️ if this project helped you!

📝 License

Copyright © 2022 vocalime.

This project is MIT licensed.

Readme

Keywords

Package Sidebar

Install

npm i @vocalime/jovo-standard-events-plugin

Weekly Downloads

0

Version

2.0.2

License

MIT

Unpacked Size

8.89 kB

Total Files

9

Last publish

Collaborators

  • acerbisgianluca