I want to write a Node.js V8 addon in C++ that will give me access to functions closures.
Something like this:
const myAddon = require('./build/Release/addon');
const counter = (() => {
let i = 0;
return () => ++i;
})();
counter(); // 1
counter(); // 2
const closure = myAddon(counter);
console.log(closure.i); // prints "3"
Is it possible? Where this information stored on the V8 engine?