Implement `wait` helper method

@jsdevel I've modified the API a bit from what we drafted in gh-76; I think that requiring options be specified via named attributes of an `options` object makes the resulting code more readable (and also avoids problems like the "boolean trap", where users are forced to remember arbitrary argument ordering details).

> Allow users to specify an arbitrary JavaScript function as a waiting
> condition. This function will be called at an (overridable) interval
> until it returns a truthy value. If the function does not return a
> truthy value within an (overridable) timeout, throw an error.