- Source:
- index.js
Methods
-
<static> hookInvoke(obj, onCalling, onCalled)
-
Add hooks before an object's method is being called and after.
Parameters:
Name Type Description obj
* onCalling
* Before hook
onCalled
* After hook
- Source:
- lang/hookInvoke.js
Returns:
The hooked object
- Type
- Object
-
<static> ifThen(obj, predicate, then)
-
Shortcut function for returning an alternative value if predicate returns true
Parameters:
Name Type Description obj
* predicate
* then
* - Source:
- lang/ifThen.js
Returns:
Returns then if predicate(obj) is true, otherwise returns the original obj
- Type
- *
-
<async, static> sleep_(ms)
-
Sleep for milliseconds
Parameters:
Name Type Description ms
integer milliseconds
- Source:
- lang/sleep_.js
Returns:
- Type
- Promise
-
<async, static> waitUntil_(checker [, checkInterval] [, maxRounds])
-
Run the checker every given duration for certain rounds until the checker returns non-false value.
Parameters:
Name Type Argument Default Description checker
function predicator
checkInterval
integer <optional>
1000 maxRounds
integer <optional>
10 - Source:
- lang/waitUntil_.js
Returns:
- Type
- Promise.<boolean>