SWIG/Examples/javascript/native/

Manually wrapped callback function in JavaScript

This example demonstrates how to manually add callback feature support to a SWIG module.

Notes

The V8 code queues the callback request for processing using the UV interface. An async function callback is invoked when the system is ready to process the next request. When the async function finishes, a completion function callback is invoked to finalize the request. Here the callback function parameter is invoked.

UV request queueing is only necessary for operations that would take a really long or otherwise unpredictable amount of time (async operations). A callback parameter could also be invoked immediately within the API function.