We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
new
As as module exports, to provide a wrapped JS function to call the constructor with new. e.g.
var nativemod = require("build/Release/mynativemod"); exports.Ctor = function () { return new nativemod.Ctor(); };
bind
If usual functions, you can use apply or call and arguments for forwarding wrapped functions.
apply
call
arguments
For wrapping constructors, combine with ECMAScript5 bind as:
var WrapperCtor = function Ctor() { var args = [null].concat([].slice.call(arguments)); var ctor = RawCtor.bind.apply(RawCtor, args); return new ctor; };
note: wrap constructor with explicit arguments
var WrappedCtor = function Ctor(arg1, arg2) { var ctor = RawCtor.bind(null, arg1, arg2); return new ctor; };
Generic version is switched bind call with apply and arguments.
There was an error while loading. Please reload this page.