FireBreath  1.4.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Pages
int FB::BrowserHost::delayedInvoke ( const int  delayms,
const FB::JSObjectPtr func,
const FB::VariantList args,
const std::string &  fname = "" 

Executes the provided method object after a delay using window.setTimeout.

This is basically a wrapper for the Javascript setTimeout function that allows passing parameters to the function you want called after a delay. This is used behind the scenes by InvokeAsync with the delayms set to 0

delaymsDelay time in milliseconds
funcJavascript object (or function)
argsArray of arguments to pass to the function
fnameIf provided, the func.fname method will be called instead of invoking func as a function
id returned by setTimeout

Definition at line 166 of file BrowserHost.cpp.

References FB::variant_list_of().

168 {
170  FB::JSObjectPtr delegate = getDelayedInvokeDelegate();
171  if (!delegate)
172  return -1; // this is wrong (the return is meant to be the result of setTimeout)
173  if (fname.empty())
174  return delegate->Invoke("", FB::variant_list_of(delayms)(func)(args)).convert_cast<int>();
175  else
176  return delegate->Invoke("", FB::variant_list_of(delayms)(func)(args)(fname)).convert_cast<int>();
177 }
boost::shared_ptr< FB::JSObject > JSObjectPtr
Defines an alias representing a JSObject shared_ptr (you should never use a JSObject* directly) ...
Definition: APITypes.h:109
FB::detail::VariantListInserter variant_list_of(FB::variant v)
Allows convenient creation of an FB::VariantList.
Definition: variant_list.h:122
void assertMainThread() const
When running in debug mode, asserts that the call is made on the main thread.

Here is the call graph for this function: