- polling(callback, interval, immediate?): {
promise: Promise<void>;
cancel: (() => void);
} 参数
- callback: ((times: number) => void | Promise<any>)
- (times): void | Promise<any>
返回 void | Promise<any>
- interval: number
可选
immediate: boolean = true
返回 {
promise: Promise<void>;
cancel: (() => void);
}
promise: Promise<void>
cancel: (() => void)
轮询函数
用于代替setInterval,回调且支持promise