Skip to content

Latest commit

 

History

History
40 lines (32 loc) · 3.77 KB

cp.just.md

File metadata and controls

40 lines (32 loc) · 3.77 KB

docs » cp.just


This module provides functions to help with performing tasks which may be delayed, up to a finite number of loops.

API Overview

API Documentation

Functions

Signature cp.just.doUntil(actionFn[, timeout[, frequency]]) -> value
Type Function
Description Performs an action function, looping until the result of the function evaluates to true (or a non-nil value).
Parameters
  • actionFn - a fuction which is called on each loop. It should return a 'truthy' value.
  • timeout - (optional) the number of seconds after which we will give up. Defaults to 1 second.
  • frequency - (optional) the amount of time between checks. Defaults to 1 millisecond.
Returns
  • The last return value of the action function.
Signature cp.just.doWhile(actionFn[, timeout[, frequency]]) -> value
Type Function
Description Performs an 'action' function, looping while the result of the function evaluates to true.
Parameters
  • actionFn - a fuction which is called on each loop. It should return a 'truthy' value.
  • timeout - (optional) the number of seconds after which we will give up. Defaults to 1 second.
  • frequency - (optional) the time between checks. Defaults to 1 millisecond.
Returns
  • The last return value of the action function.
Signature cp.just.wait(integer) -> nil
Type Function
Description Pauses the application for the specified number of seconds.
Parameters
  • periodInSeconds - the number of seconds to pause for.
Returns
  • None