Available since 2.9.0
Tries to lock a resource.
Returns a promise, resolving to a boolean value.
timeout (see constructor options) has been set with a number greater than or equal to 0, then you must check the boolean result to verify if the lock has been acquired or not.
If the lock timeout was set to
-1, the promise will only be resolved once the lock has successfully been acquired, and the boolean result is always
Edit this page on Github (opens new window)