UNPKG

448 BTypeScriptView Raw
1/**
2 * 创建一个只能调用一次的函数,只会返回第一次执行后的结果
3 * @param callback 回调
4 * @param context 上下文
5 * @param params 额外的参数
6 */
7export declare function once<S, C>(callback: (this: S, ...args: any[]) => any, context?: C, ...params: any[]): (this: S | C, ...args: any[]) => any;
8
9declare module './ctor' {
10 interface XEUtilsMethods {
11 once: typeof once;
12 }
13}
14
15export default once