34 lines
501 B
TypeScript
34 lines
501 B
TypeScript
// @lib: es5
|
|
class Event {
|
|
|
|
private _listeners: any[] = [];
|
|
|
|
constructor () {
|
|
|
|
// TODO: remove
|
|
|
|
this._listeners = [];
|
|
|
|
}
|
|
|
|
add(listener: () => any): void {
|
|
|
|
/// <summary>Registers a new listener for the event.</summary>
|
|
|
|
/// <param name="listener">The callback function to register.</param>
|
|
|
|
this._listeners.push(listener);
|
|
|
|
}
|
|
|
|
}
|
|
|
|
class ItemSetEvent extends Event {
|
|
|
|
add(listener: (items: ItemSet) => void ) {
|
|
|
|
super.add(listener);
|
|
|
|
}
|
|
|
|
}
|