From 3132f93f01c92aab9583ddc531a29b1211bb4ec2 Mon Sep 17 00:00:00 2001 From: Gorkem CINAR Date: Wed, 13 Dec 2017 09:33:33 +0000 Subject: [PATCH] minor bug fixes --- .gitignore | 3 ++- .npmignore | 4 +++- package.json | 4 ++-- src/module.ts | 6 ++++-- src/worker.ts | 2 +- tsconfig.json | 7 ++++--- 6 files changed, 16 insertions(+), 10 deletions(-) diff --git a/.gitignore b/.gitignore index b3f9b88..a0d6c8f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ node_modules *.log* -dist \ No newline at end of file +dist +typings \ No newline at end of file diff --git a/.npmignore b/.npmignore index ff37dc8..8835e08 100644 --- a/.npmignore +++ b/.npmignore @@ -1,2 +1,4 @@ tsconfig.json -src \ No newline at end of file +src +gulpfile.js +tslint.json \ No newline at end of file diff --git a/package.json b/package.json index 09a1ca6..005dfac 100644 --- a/package.json +++ b/package.json @@ -1,9 +1,9 @@ { "name": "worker-interval", - "version": "1.0.0", + "version": "1.0.6", "description": "setInterval and clearInterval implementation to support keep running on inactive tabs for Chrome, Firefox and IE", "main": "dist/module.js", - "types": "dist/module.d.ts", + "types": "typings/module.d.ts", "keywords": [ "clearInterval", "clear interval", diff --git a/src/module.ts b/src/module.ts index bf6881e..6da8f90 100644 --- a/src/module.ts +++ b/src/module.ts @@ -1,5 +1,7 @@ import WorkerInterval from "./workerInterval"; const workerInterval = new WorkerInterval(); -export const clearInterval = workerInterval.clearInterval; -export const setInterval = workerInterval.setInterval; +export const clearInterval = (id:string): void => workerInterval.clearInterval(id); +export const setInterval = (callback: () => void, delay: number): string | null => { + return workerInterval.setInterval(callback, delay) +}; diff --git a/src/worker.ts b/src/worker.ts index d0a7814..bbbd8b4 100644 --- a/src/worker.ts +++ b/src/worker.ts @@ -20,7 +20,7 @@ onmessage = (event) => { switch (intervalWork.name) { case "setInterval": { intervalWork.name = "runCallback"; - const intervalId = setInterval(() => { postMessage(intervalWork,); }, intervalWork.delay); + const intervalId = setInterval(() => { postMessage(intervalWork); }, intervalWork.delay); scheduledIntervalWorks.push({ id: intervalWork.id, intervalId, diff --git a/tsconfig.json b/tsconfig.json index fb3d4ce..e2316f8 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -4,6 +4,7 @@ "emitDecoratorMetadata": true, "experimentalDecorators": true, "declaration": true, + "declarationDir": "typings", "noImplicitAny": true, "noImplicitReturns": true, "removeComments": true, @@ -13,11 +14,11 @@ "target": "es5", "outDir": "./dist", "lib": [ - "es6", - "webworker" + "es6", + "webworker" ] }, "include": [ - "src/**/*" + "src/**/*" ] } \ No newline at end of file