import {LEvent} from "./LEvent";
import {DisPatcherOn} from "./DisPatcherOn";

/*
* name;
*/
export class DispatcherManager
{
    static  init():void
    {
        DisPatcherOn.Instance;
    }

    //新建事件
    static  Event(type: string, obj: Object = null, bubbles: boolean = false, cancelable: boolean = false): Laya.Event {
        return new LEvent(type, obj, bubbles, cancelable);
    }

    //派发事件
    static  dispatchEvent(type: string, obj: Object = null, bubbles: boolean = false, cancelable: boolean = false): void {
        DisPatcherOn.Instance.dispatchEvent(type, obj);
    }

    //监听事件
    static  addEventListener(type: string, thisObject: any, listener: Function, useCapture: boolean = false, priority: number = 0): void {
        DisPatcherOn.Instance.addEventListener(type, listener, thisObject, useCapture, priority);
    }

    static  hasEventListener(type: string): boolean {
        return DisPatcherOn.Instance.hasEventListener(type);
    }

    static  removeEventListener(type: string, thisObject: any, listener: Function, useCapture: boolean = false, priority: number = 0): void {
        DisPatcherOn.Instance.removeEventListener(type, listener, thisObject);
    }
}