Print this page
XXX doco cleanup
XXX first cut of crosscall

*** 218,228 **** corresponding C function is invoked. `op` is the C object associated with the JavaScript object, and `ap` is the encoded list of arguments to the function. Return an encoded object with a `res` member, or use one of the error/exception patterns. ! ### nvlist_t *v8plus_c_static_method_f(nvlist_t *ap) In addition to methods on the native objects returned by your constructor, you can also provide a set of functions on the native binding object itself. This may be useful for providing bindings to libraries for which no object representation makes sense, or that have functions that operate outside the --- 218,228 ---- corresponding C function is invoked. `op` is the C object associated with the JavaScript object, and `ap` is the encoded list of arguments to the function. Return an encoded object with a `res` member, or use one of the error/exception patterns. ! ### nvlist_t *v8plus_c_static_method_f(const nvlist_t *ap) In addition to methods on the native objects returned by your constructor, you can also provide a set of functions on the native binding object itself. This may be useful for providing bindings to libraries for which no object representation makes sense, or that have functions that operate outside the
*** 622,632 **** This mechanism uses `uv_queue_work()` and as such will tie up one of the worker threads in the pool for as long as `async_worker` is running. The other asynchronous mechanism is the Node.js `EventEmitter` model. This model requires some assistance from JavaScript code, because v8+ native ! objects no not inherit from `EventEmitter`. To make this work, you will need to create a JavaScript object (the object your consumers actually use) that inherits from `EventEmitter`, hang your native object off this object, and populate the native object with an appropriate method that will cause the JavaScript object to emit events when the native object invokes that method. A simple example might look like this: --- 622,632 ---- This mechanism uses `uv_queue_work()` and as such will tie up one of the worker threads in the pool for as long as `async_worker` is running. The other asynchronous mechanism is the Node.js `EventEmitter` model. This model requires some assistance from JavaScript code, because v8+ native ! objects do not inherit from `EventEmitter`. To make this work, you will need to create a JavaScript object (the object your consumers actually use) that inherits from `EventEmitter`, hang your native object off this object, and populate the native object with an appropriate method that will cause the JavaScript object to emit events when the native object invokes that method. A simple example might look like this: