Timer
used for making sure a code block runs within a certain amount of time
Static Method Summary
Static Public Methods | ||
public static |
creates a new Timer |
Constructor Summary
Public Constructor | ||
public |
constructor(config: Object) constructor |
Method Summary
Public Methods | ||
public |
begin(): * convenience method to begin a Timer |
|
public |
cancel(): * cancels a Timer so it will not throw |
|
public |
error(msg: <type>) Throws a Timer Error |
|
public |
touch(): * Restarts a Timer's clock |
Static Public Methods
public static create(config: Object): * source
creates a new Timer
Params:
Name | Type | Attribute | Description |
config | Object | The config object |
|
config.name | String | [__filename where Timer is created] The name of the Timer (for errors) |
|
config.max_run_time | Integer | [1 minute] The max run time in milliseconds |
|
config.after | Function | [Timer.prototype.error] The function to run after a Timer ends |
Return:
* |
Public Constructors
Public Methods
public error(msg: <type>) source
Throws a Timer Error
Params:
Name | Type | Attribute | Description |
msg | <type> | The error message |