javascript - How to create a derived type of a native (node.js) class/constructor? -


i have native node.js module exports constructor function uses objectwrap. uses nan module , looks this:

// create scope nanscope();  // initialize wrapper auto *mw = new mywrap(); ...  // wrap object mw->wrap(args.this());  nanreturnthis(); 

i'd inherit constructor. here's i've tried:

var m = require('mymodule'); function derived () { } util.inherits(derived, m.myconstructor); 

after that:

var d = new derived(); 

the result d instanceof m.myconstructor returns true, if pass derived instance native functions accept instance of m.myconstructor, cannot unwrap because internalfieldcount() 0.

also tried following:

function derived () { m.myconstructor.call(this); } 

which resulted in similar problem:

void node::objectwrap::wrap(v8::handle<v8::object>): assertion `handle->internalfieldcount() > 0' failed.` 

what's right way inherit constructor function uses objectwrap under hood?


Comments

Popular posts from this blog

angularjs - ADAL JS Angular- WebAPI add a new role claim to the token -

php - CakePHP HttpSockets send array of paramms -

node.js - Using Node without global install -