Skip to content
This repository was archived by the owner on Feb 26, 2024. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 5 additions & 2 deletions lib/common/timers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,11 @@ export function patchTimer(window: any, setName: string, cancelName: string, nam
return task;
}
// Node.js must additionally support the ref and unref functions.
const handle = (<TimerOptions>task.data).handleId;
if ((<any>handle).ref && (<any>handle).unref) {
const handle: any = (<TimerOptions>task.data).handleId;
// check whether handle is null, because some polyfill or browser
// may return undefined from setTimeout/setInterval/setImmediate/requestAnimationFrame
if (handle && handle.ref && handle.unref && typeof handle.ref === 'function' &&
typeof handle.unref === 'function') {
(<any>task).ref = (<any>handle).ref.bind(handle);
(<any>task).unref = (<any>handle).unref.bind(handle);
}
Expand Down