@aegenet/belt-hook
v2.3.0
Published
Hook function -> Not for production use! TESTS ONLY!
Downloads
90
Readme
@aegenet/belt-hook
Hook function -> Not for production use! TESTS ONLY!
💾 Installation
yarn add @aegenet/belt-hook@^2.0.0
# or
npm i @aegenet/belt-hook@^2.0.0
📝 Usage
import { hook } from '@aegenet/belt-hook';
/** context: { inc: () => void } */
const token = hook({
context,
name: 'inc',
beforeCall: data => {
/** Do something */
},
afterCall: data => {
/** Do Something */
},
});
context.inc(); /** beforeCall() -> inc() -> afterCall() */
token.dispose();