From caa4bcf3391b3d45f2cee9b3714054afcb4d0aed Mon Sep 17 00:00:00 2001 From: Chanyoung Park Date: Mon, 1 Apr 2024 13:38:40 +0900 Subject: [PATCH 1/4] Fix: Exclude examples directory from version control To keep the repository clean and focused on the source code, this commit updates .gitignore and .npmignore to exclude the examples directory. The examples directory contains real-world usage examples of the library, which are not necessary for the package functionality but useful for developers. By excluding these files from version control, we minimize the package size and streamline the development process. --- .npmignore | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index b823691..66aaba5 100644 --- a/.npmignore +++ b/.npmignore @@ -1,4 +1,5 @@ .gitignore .git/ node_modules/ -npm-debug.log \ No newline at end of file +npm-debug.log +examples/ \ No newline at end of file From e28123a49faa03a4722a86a8bba449c1e110c7dc Mon Sep 17 00:00:00 2001 From: Chanyoung Park Date: Mon, 1 Apr 2024 14:36:31 +0900 Subject: [PATCH 2/4] Update: API Reference in README to Reflect Revised API Structure This commit updates the API Reference section of the README.md file to accurately reflect the changes made to the WWTimer API structure. It clarifies the usage of the start(), pause(), and destroy() methods according to the new implementation where the callback function and interval are specified at the instance creation. This change ensures that the documentation is in sync with the current API design, making it easier for users to understand how to implement and use the WWTimer in their projects. --- README.md | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/README.md b/README.md index 1e29def..aa7b5bd 100644 --- a/README.md +++ b/README.md @@ -29,12 +29,12 @@ yarn add ww-timer import WWTimer from 'ww-timer'; // Create a new timer -const timer = new WWTimer(); +const timer = new WWTimer(() => { + console.log('Timer tick'); +}, 2000); // Start the timer with a callback function -timer.start(() => { - console.log('Timer tick'); -}); +timer.start(); // Pause the timer timer.pause(); @@ -44,9 +44,11 @@ timer.destroy(); ``` ## API Reference -- `start(callback, interval)`: Starts the timer with the specified callback function and interval. -- `pause()`: Stops the timer. -- `destroy()`: Destroy the timer instance. +- `new WWTimer(callback, interval)`: Creates a new `WWTimer` instance with a callback function to be executed at a specified interval. +- `start()`: Starts the timer. The timer will call the callback function at the interval specified during the instance creation. +- `pause()`: Pauses the timer. The timer can be resumed by calling `start()` again. +- `destroy()`: Destroys the timer instance and frees up resources. After calling this method, the timer instance cannot be used or restarted. + ## Compatibility Compatible with most modern web browsers that support the Web Workers API. From 1ac1514df8b4bf6a012a4c3abf19715d70b8121a Mon Sep 17 00:00:00 2001 From: Chanyoung Park Date: Mon, 1 Apr 2024 14:42:03 +0900 Subject: [PATCH 3/4] v1.0.2 --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 293e288..edcd897 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ww-timer", - "version": "1.0.1", + "version": "1.0.2", "keywords": [ "web worker", "timer", From abe4ec7336abd953b18a7c263066ff997a1b01a9 Mon Sep 17 00:00:00 2001 From: Chanyoung Park Date: Tue, 2 Apr 2024 11:15:46 +0900 Subject: [PATCH 4/4] Update: Optimize package size by refining .npmignore Updated the .npmignore file to exclude additional files and directories such as .github/, .eslintrc.js, husky/, src/, and rollup.config.mjs along with banner.jpg. This change aims to further reduce the size of the build package, ensuring a more efficient distribution and installation process. --- .npmignore | 6 ++++++ README.md | 2 +- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/.npmignore b/.npmignore index 72b24a0..6490adc 100644 --- a/.npmignore +++ b/.npmignore @@ -1,5 +1,11 @@ .gitignore .git/ +.github/ +.eslintrc.js +husky/ +src/ node_modules/ npm-debug.log examples/ +rollup.config.mjs +banner.jpg \ No newline at end of file diff --git a/README.md b/README.md index aa7b5bd..f00a478 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -![WW Timer](./banner.jpg) +![WW Timer](https://github.com/univdev/ww-timer/raw/master/banner.jpg) # WW Timer WW Timer is a highly accurate timer library for web browsers.