0.1.0 • Published 3 years ago
@lucets/upgrade-hooks v0.1.0
Luce
Upgrade hooks for @lucets/luce.
Can be used stand-alone as well. Zero dependencies!
Install
Install through npm:
npm i @lucets/upgrade-hooks
Example
'use strict'
import UpgradeHooks from './index'
export interface Context {
[key: string]: any
}
const hooks = new UpgradeHooks<Context>()
// Add a hook
hooks.add(async (ctx, next) => {
console.log('[upgrade]: incoming request')
})
// Run hooks
const ctx = {}
hooks.run(ctx).then(() => {
console.log('hooks successfully run')
}).catch((err: Error) => {
console.error(err)
})
License
Copyright 2021 Michiel van der Velde.
This software is licensed under the MIT License.
0.1.0
3 years ago