lang

lang

Source:

Methods

(static) hookInvoke(obj, onCalling, onCalled) → {Object}

Add hooks before an object's method is being called and after.

Source:
Parameters:
Name Type Description
obj *
onCalling *

Before hook

onCalled *

After hook

Returns:
Type:
Object

The hooked object

(static) ifThen(obj, predicate, then) → {*}

Shortcut function for returning an alternative value if predicate returns true

Source:
Parameters:
Name Type Description
obj *
predicate *
then *
Returns:
Type:
*

Returns then if predicate(obj) is true, otherwise returns the original obj

(async, static) sleep_(ms) → {Promise}

Sleep for milliseconds

Source:
Parameters:
Name Type Description
ms integer

milliseconds

Returns:
Type:
Promise

(async, static) waitUntil_(checker, checkIntervalopt, maxRoundsopt) → {Promise.<boolean>}

Run the checker every given duration for certain rounds until the checker returns non-false value.

Source:
Parameters:
Name Type Attributes Default Description
checker function

predicator

checkInterval integer <optional>
1000
maxRounds integer <optional>
10
Returns:
Type:
Promise.<boolean>