-
Notifications
You must be signed in to change notification settings - Fork 1
Open
Labels
Description
void TestResponse.time(String handler, [Integer poll=10], Function<Boolean> test)
Takes a test function, and times how long it takes until the function returns a truthy value. Polls test every poll ms, defaulting to 10ms. Outputs the time as an integer via TestResponse.emit under the handler given.
Promise TestResponse.delayUntil([Array<Anything> args [, Integer poll=10], ] Function<Boolean> test)
Returns a promise that resolves after test returns a truthy value. Polls test every poll ms, defaulting to 10ms. Values passed as args are returned in the promise, as an array.
Example usage:
require ["jquery", "MyModule", "TestResponse"], ($, MyModule, TestResponse) ->
MyModule.writeToDivLater "#output", "Blah Blah"
TestResponse.time "time-to-output", -> $("#output").text() is "Blah Blah"
TestResponse
.delayUntil -> $("#output").text() is "Blah Blah"
.then ->
TestResponse.emit "output-length", $("#output").text().length- Implement
- Document in guide