Methods
(static) alerter(msg)
Shortcut to () => alert(msg)
Parameters:
Name | Type | Description |
---|---|---|
msg |
string |
Example
/// alert later
setTimeout(alerter("wow"), 1000);
setTimeout(() => alert("wow"), 1000); //< old way
(static) logger() → {function}
Shortcut to () => console.debug(...)
but returns the function again
Parameters:
Type | Attributes | Description |
---|---|---|
any |
<repeatable> |
arguments to |
Returns:
- a function call
console.debug
and returns its arguments
- Type
- function
Examples
/// useful for promise which resolves nothing
fsPromises.unlink(someFileToDelete)
.then(logger("success"))
.catch(logger("failure"));
/// pass throught some promise resolves
fetch(someURL)
.then(logger("fetch result")) // simply comment this line if you don't want it.
.then(resp => {
console.debug("fetch result", resp); // old way
// handle the response
});