UNPKG

actionhero

Version:

actionhero.js is a multi-transport API Server with integrated cluster capabilities and delayed tasks

28 lines (27 loc) 962 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.Initializer = void 0; /** * Create a new Actionhero Initializer. The required properties of an initializer. These can be defined statically (this.name) or as methods which return a value. */ class Initializer { constructor() { this.name = null; this.loadPriority = 1000; this.startPriority = 1000; this.stopPriority = 1000; } validate() { if (!this.name) { throw new Error("name is required for this initializer"); } ["loadPriority", "startPriority", "stopPriority"].forEach((priority) => { if (!this[priority] || typeof this[priority] !== "number" || this[priority] < 0) { throw new Error(`${priority} is a required property for the initializer \`${this.name}\``); } }); } } exports.Initializer = Initializer;