2.0.2 ā€¢ Published 1 year ago

@vocalime/jovo-standard-events-plugin v2.0.2

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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.

2.0.2

1 year ago

2.0.1

2 years ago

2.0.0

2 years ago

1.0.1

2 years ago

1.0.0

2 years ago