UNPKG

packsuit

Version:
18 lines (17 loc) 344 B
'use strict' class Hook { constructor() { this.plugins = []; } apply(hook, data) { this.plugins.forEach(plugin => { if(plugin[hook]){ plugin[hook](data); } }) } plugin(plugin) { this.plugins.push(plugin) } } module.exports = Hook;