Does it possible to pass javascript instantiated object to the (c++) native addon? For example consider following code snippet - the 'sum' function must be called within native addon ( within fn() ) and the result is returned back to JS part:
var addon = require('addon');
var JSClass = (function () {
function JSClass(a, b) {
this.a = a;
this.b = b;
}
JSClass.prototype.sum = function () {
return this.a + this.b;
};
return JSClass;
})();
var result = addon.fn(new JSClass(3, 5));
console.log("resulted sum = " + result);
I tried to adapt this example of passing wrapped object without success.