/* interface ListType<T> {
    callback: T,
    thisObj: any,
    bindFunc?:any
}
export default class MEvent<T extends Function>{
    private list: ListType<T>[] = [];
    private removeSelf: boolean = true;
    constructor(removeSelf: boolean = true) {
        this.removeSelf = removeSelf;
    }
    public add(callback: T, thisObj: any) {
        this.list.push({
            callback: callback,
            thisObj: thisObj
        });
    }
    public remove(callback: T, thisObj: any) {
        this.list = this.list.filter(e => e.callback !== callback || e.thisObj !== thisObj);
    }

    private removeList: Function[] = [];
    public call(...args: any[]) {
        this.removeList = [];


        this.list.forEach(e => {
            if (this.removeSelf) {
                e.callback.bind
                (this.)(...args, () => {
                    this.removeList.push(e);
                });
            } else {
                e(...args);
            }
        });

        this.list = this.list.filter(e => {
            for (let i of this.removeList) {
                if (i === e) {
                    return false;
                }
            }
            return true;
        });
    }
} */