@lucets/upgrade-hooks

0.1.0 • Public • Published

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.

Dependencies (0)

    Dev Dependencies (0)

      Package Sidebar

      Install

      npm i @lucets/upgrade-hooks

      Weekly Downloads

      1

      Version

      0.1.0

      License

      MIT

      Unpacked Size

      3.67 kB

      Total Files

      5

      Last publish

      Collaborators

      • michielvdvelde