The waitFor method waits for a new data stream from the host and for a match to occur.
This method works like the wait method, but expects a match. If the match doesn't occur, it waits for a new change or times out.
If there are two or more matches defined, waitFor selects the best match and calls the associated callback function.
Call Parameters (mode 1)
Parameter name
|
Parameter type
|
Explanation
|
match
|
String or RegExp
|
Represents the value to match in the received stream.
|
success
|
function
|
Callback to be called when the match occurs.
|
fail
|
function
|
Callback to be called when the match fails.
|
timeout
|
integer
|
Time to wait for the match, in milliseconds.
|
Call Parameters (mode 2)
Parameter name
|
Parameter type
|
Explanation
|
matches
|
Javascript object array
|
An array containing a set of matching objects.
|
fail
|
function
|
Callback to be called when the match fails.
|
timeout
|
integer
|
Time to wait for the match, in milliseconds.
|
Matching Object Structure
Parameter name
|
Parameter type
|
Explanation
|
match
|
String or RegExp
|
Represents the value to match in the received stream.
|
function
|
function
|
Callback to be called when the match occurs.
|
Return Object
This function does not return any object.
See also
|