You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
39 lines
896 B
39 lines
896 B
/*
|
|
* @Description:
|
|
* @Autor: YeeChan
|
|
* @Date: 2019-11-26 14:13:43
|
|
*/
|
|
|
|
/**
|
|
* 事件绑定接口
|
|
*/
|
|
export class FMListener {
|
|
callback: Function; //对象回调方法
|
|
target: any; //对象本身
|
|
}
|
|
|
|
/**
|
|
* 添加一个绑定接口
|
|
* @param callback //对象回调方法
|
|
* @param target //对象本身
|
|
* @returns FMListener
|
|
*/
|
|
export function handleFM_custom(callback: Function, target: any): FMListener {
|
|
return { "target": target, "callback": callback }
|
|
}
|
|
|
|
/**
|
|
* call一个绑定接口
|
|
* @param FMListener
|
|
* @param ...argArray
|
|
* @returns any
|
|
*/
|
|
export function callFM_custom(inter: FMListener, ...argArray: any[]): any {
|
|
if (inter && inter.callback) {
|
|
return inter.callback.call(inter.target, ...argArray)
|
|
}
|
|
}
|
|
//导出
|
|
(<any>window).FMListener = FMListener;
|
|
(<any>window).handleFM_custom = handleFM_custom;
|
|
(<any>window).callFM_custom = callFM_custom; |