Home Reference Source

vgui/15-bind-event.js

/**
 * Event that is dispatched when a registered binding changes
 */
export class BindEvent extends Event {
	/**
	 * Creates a new BindEvent
	 * @param {string} key - The key that changed
	 * @param value - The new value
	 */
	constructor(key, value) {
		if (!key)
			throw new Error("Parameter key not set!");
		super();
		this._key = key;
		this._value = value;
	}

	/**
	 * The key that changed
	 */
	get key() {
		return this._key;
	}

	/**
	 * The new value
	 */
	get value() {
		return this._value;
	}

	/**
	 * @override
	 */
	get type() {
		return "BindEvent";
	}
}