UNPKG

woltlab-compiler

Version:

A compiler for WoltLab-Package Archives and WoltLab-Package Components

94 lines 2.89 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const util_1 = require("util"); const ListenerEnvironment_1 = require("./ListenerEnvironment"); /** * Represents a component which listens to specific events. */ class Listener { /** * Initializes a new instance of the `Listener` class. */ constructor(options) { /** * The environment to install the listener to. */ this.environment = ListenerEnvironment_1.ListenerEnvironment.FrontEnd; /** * A number indicating the execution order of the event-listener. */ this.executionOrder = null; /** * The permissions of which the active user must have at least one in order to execute the listener. */ this.permissions = []; /** * The options of which at least one must be enabled in order to execute the listener. */ this.options = []; this.Name = options.Name; if (!util_1.isNullOrUndefined(options.Environment)) { this.Environment = options.Environment; } this.EventName = options.EventName; if (!util_1.isNullOrUndefined(options.ExecutionOrder)) { this.ExecutionOrder = options.ExecutionOrder; } if (!util_1.isNullOrUndefined(options.Permissions)) { this.Permissions.push(...options.Permissions); } if (!util_1.isNullOrUndefined(options.Options)) { this.Options.push(...options.Options); } } /** * Gets or sets the name of the listener. */ get Name() { return this.name; } set Name(value) { this.name = value; } /** * Gets or sets the environment to install the listener to. */ get Environment() { return this.environment; } set Environment(value) { this.environment = value; } /** * Gets or sets the name of the event to listen to. */ get EventName() { return this.eventName; } set EventName(value) { this.eventName = value; } /** * Gets or sets a number indicating the execution order of the event-listener. */ get ExecutionOrder() { return this.executionOrder; } set ExecutionOrder(value) { this.executionOrder = value; } /** * Gets the permissions of which the active user must have at least one in order to execute the listener. */ get Permissions() { return this.permissions; } /** * Gets the options of which at least one must be enabled in order to execute the listener. */ get Options() { return this.options; } } exports.Listener = Listener; //# sourceMappingURL=Listener.js.map