@oscarpalmer/timer 0.12.0 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -0
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -60,6 +60,20 @@ Both the nice helper methods and the class syntax create similar objects – `Wa
|
|
|
60
60
|
|`stop()`|Stops the timer|
|
|
61
61
|
|`restart()`|Restarts the timer|
|
|
62
62
|
|
|
63
|
+
## Callbacks
|
|
64
|
+
|
|
65
|
+
When you create a repeated timer, you can also provide a fourth parameter to act as a callback to run when the timer stops, as below:
|
|
66
|
+
|
|
67
|
+
```typescript
|
|
68
|
+
function after(finished: boolean) {
|
|
69
|
+
// Let's do something fun!
|
|
70
|
+
}
|
|
71
|
+
|
|
72
|
+
repeat(() => {}, 0, 10, after);
|
|
73
|
+
```
|
|
74
|
+
|
|
75
|
+
The `finished`-parameter for the `after`-function can be used to determine if the timer was stopped manually, or if it was able to finish its work.
|
|
76
|
+
|
|
63
77
|
## License
|
|
64
78
|
|
|
65
79
|
[MIT licensed](LICENSE), natch :wink:
|
package/package.json
CHANGED