Constructor
new DeadMansSwitch(delay, callback)
Class to be able to execute function chains
Create new dead man's switch
Parameters:
Name | Type | Description |
---|---|---|
delay | Integer | |
callback | function |
- Since
- 1.29.0
- Copyright
- schukai GmbH
- License
- AGPLv3
Throws:
value is not an integer
- Type
- TypeError
Example
import {DeadMansSwitch} from '@schukai/monster/source/util/deadmansswitch.mjs';
const deadmansswitch = new DeadMansSwitch(100, () => {
console.log('yeah!')
// ↦ "yeah!"
})
deadmansswitch.touch(); // from here wait again 100 ms
deadmansswitch.touch(200); // from here wait 200 ms
Methods
touch(delayopt)
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
delay | Integer | | <optional> |