0.1.0 • Published 3 years ago

@lucets/upgrade-hooks v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

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.