Skip to content

Commit

Permalink
New version
Browse files Browse the repository at this point in the history
  • Loading branch information
blaumeise20 committed Jan 10, 2021
1 parent 3490059 commit 17b75b7
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
6 changes: 6 additions & 0 deletions .npmignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
node_modules/
.github/
.editorconfig
.gitattributes
.gitignore
index.test.js
20 changes: 10 additions & 10 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Timeout and Interval
Implementation of setTimeout and setInterval with pause.

**This package is currently NOT tested, I would love to hear your feedback!! Feel free to [open an issue](https://github.com/blaumeise20/date-timeout-interval/issues/new)!**
**The test coverage of this package is currently NOT GOOD, I would love to hear your feedback!! Feel free to [open an issue](https://github.com/blaumeise20/date-timeout-interval/issues/new)!**

## Instalation

Expand Down Expand Up @@ -30,19 +30,19 @@ This will add `Timeout` and `Interval` to `Date`.
`autoStart: boolean` - If the timer should automatically start. This will call `start` internally.

* `start(): this`

Starts the timer. If the timer is currently paused, it will resume the timer.

* `stop(): this`

Stops the timer and resets it to 0. Acts like `clearTimeout`.

* `pause(): this`

Pauses the timer without reseting it. This is the main functionality of this class.

* `state: 0 | 1 | 2 | 3`

Defines the current state of the timer.
| State | Description |
|:-----:| ----------- |
Expand All @@ -65,19 +65,19 @@ This will add `Timeout` and `Interval` to `Date`.
`autoStart: boolean` - If the timer should automatically start. This will call `start` internally.

* `start(): this`

Starts the interval. If the interval is currently paused, it will resume the interval.

* `stop(): this`

Stops the interval and resets it to 0. Acts like `clearInterval`.

* `pause(): this`

Pauses the interval without reseting it. This will also remember the time left to the next call, so if you resume it again, it will continue at the position it stopped.

* `state: 0 | 1 | 2`

Defines the current state of the interval. These are the same as with the timeout, but there is no "end" state, because the interval will never end.
| State | Description |
|:-----:| ----------- |
Expand All @@ -94,4 +94,4 @@ This will add `Timeout` and `Interval` to `Date`.
This will return the time left for the next execution to happen. **Warning: This will call a getter which will calculate the time, don't use this too often.**

# Licence
This project is licenced under the MIT licence. Read it [here](LICENCE).
This project is licenced under the MIT licence. Read it [here](LICENCE).
2 changes: 1 addition & 1 deletion package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "date-timeout-interval",
"version": "1.0.1",
"version": "1.1.0",
"description": "Implementation of setTimeout and setInterval with pause",
"main": "index.js",
"scripts": {
Expand Down

0 comments on commit 17b75b7

Please sign in to comment.