function fb_invoke_async in Drupal for Facebook 7.3
Call a function not now but later. As late as possible during the current request.
In practice the function will be invoked during hook_exit(). In an ideal world it might be nice to be invoked even later, similar to the way drupal processes cron in drupal_page_footer() without delaying the page returned to the user. However I know of no drupal hook called later than hook_exit.
Provided as a convenience for third-party modules that want to invoke some facebook API, but cannot do so right away. For example say your module implements hook_node_insert and wants to publish a message about the new node to facebook. You could try invoking fb_graph_publish_action() from your hook_node_insert(). Unfortunately facebook would immediately look up the new node on your server (to populate graph details), but drupal would return page not found instead of the inspected node because the insert has not yet finished! To work around this call fb_invoke_async('fb_graph_publish_action', ...) instead.
See also
fb_exit().
File
- ./
fb.module, line 1625 - This is the core required module of Drupal for Facebook.
Code
function fb_invoke_async() {
$cache =& drupal_static(__FUNCTION__);
$cache[] = func_get_args();
}