UNPKG

node-web-mvc

Version:
25 lines (24 loc) 490 B
"use strict"; /** * @module Hook * @description 更新钩子 */ Object.defineProperty(exports, "__esModule", { value: true }); class Hook { constructor() { this.handlers = []; } get count() { return this.handlers.length; } add(handler) { this.handlers.push(handler); } invoke(...args) { this.handlers.forEach((handler) => handler(...args)); } clean() { this.handlers.length = 0; } } exports.default = Hook;