mirror of
https://github.com/NativeScript/NativeScript.git
synced 2025-11-05 13:26:48 +08:00
fix(timer): setTimeout/setInterval support for boolean period (#7569)
* Fix setTimeout/setInterval can't be called with boolean period * Add typings and a test * Revert typings * Ignore the wrong type
This commit is contained in:
committed by
Alexander Vakrilov
parent
78058087c8
commit
a569bb2931
@@ -16,6 +16,9 @@ function createHandlerAndGetId(): number {
|
||||
}
|
||||
|
||||
export function setTimeout(callback: Function, milliseconds = 0, ...args): number {
|
||||
// Cast to Number
|
||||
milliseconds += 0;
|
||||
|
||||
const id = createHandlerAndGetId();
|
||||
const invoke = () => callback(...args);
|
||||
const zoneBound = zonedCallback(invoke);
|
||||
@@ -48,6 +51,9 @@ export function clearTimeout(id: number): void {
|
||||
}
|
||||
|
||||
export function setInterval(callback: Function, milliseconds = 0, ...args): number {
|
||||
// Cast to Number
|
||||
milliseconds += 0;
|
||||
|
||||
const id = createHandlerAndGetId();
|
||||
const handler = timeoutHandler;
|
||||
const invoke = () => callback(...args);
|
||||
|
||||
Reference in New Issue
Block a user