Remove event extension of NitroEvent

This commit is contained in:
Bill 2021-07-17 03:24:40 -04:00
parent 0aaac608b4
commit 27b64a1c0a
3 changed files with 19 additions and 7 deletions

View File

@ -4,6 +4,7 @@ import { IDisposable } from '../common/disposable/IDisposable';
import { INitroLogger } from '../common/logger/INitroLogger';
import { NitroLogger } from '../common/logger/NitroLogger';
import { IEventDispatcher } from './IEventDispatcher';
import { NitroEvent } from './NitroEvent';
export class EventDispatcher extends Disposable implements IEventDispatcher, IDisposable
{
@ -61,7 +62,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
}
}
public dispatchEvent(event: Event): boolean
public dispatchEvent(event: NitroEvent): boolean
{
if(!event) return false;
@ -72,7 +73,7 @@ export class EventDispatcher extends Disposable implements IEventDispatcher, IDi
return true;
}
private processEvent(event: Event): void
private processEvent(event: NitroEvent): void
{
const existing = this._listeners.get(event.type);

View File

@ -1,9 +1,10 @@
import { IDisposable } from '../common/disposable/IDisposable';
import { NitroEvent } from './NitroEvent';
export interface IEventDispatcher extends IDisposable
{
addEventListener(type: string, callback: Function): void
removeEventListener(type: string, callback: Function): void;
removeAllListeners(): void;
dispatchEvent(event: Event): boolean;
}
dispatchEvent(event: NitroEvent): boolean;
}

View File

@ -1,4 +1,14 @@
export class NitroEvent extends Event
export class NitroEvent
{
public static COMPLETE: string = 'NITRO_COMPLETE';
}
private _type: string;
constructor(type: string)
{
this._type = type;
}
public get type(): string
{
return this._type;
}
}