Skip to content

Commit

Permalink
fix: type and export issue
Browse files Browse the repository at this point in the history
  • Loading branch information
kambing86 committed Jan 8, 2020
1 parent d25b58e commit 8c18bb7
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/index.ts
Expand Up @@ -84,7 +84,8 @@ function addId({ fn, ms, args, mode }: Execution) {
return currentId;
}

function removeId(id: number) {
function removeId(id?: number) {
if (id == null) return;
if (fnMap.has(id)) {
fnMap.delete(id);
}
Expand All @@ -94,3 +95,5 @@ export const setTimeout = (fn: Function, ms = 0, ...args: any[]) => addId({ fn,
export const clearTimeout = removeId;
export const setInterval = (fn: Function, ms = 0, ...args: any[]) => addId({ fn, ms, args, mode: MODE.MODE_INTERVAL });
export const clearInterval = removeId;

export default { setTimeout, clearTimeout, setInterval, clearInterval };

0 comments on commit 8c18bb7

Please sign in to comment.