What I am trying to do is.
Create many different instances of Hyperformula.
this.hfInstance = HyperFormula.buildEmpty();
When I create these instances I want to somehow attach some data (that I want to be different for different instances) that will be accessible in the custom functions.
So far I have tried:
let plugin = this.hfInstance.getFunctionPlugin(‘HYPER’);
this.hfInstance.getConfig().ctrl = this;
plugin.ctrl = this;
In the custom function:
hyper(ast, state) {
let ctrl = Object.getPrototypeOf(this).constructor.ctrl;
console.log(ctrl.key);
return ‘Hyperformula’.length;
}
Unfortunately this will not work for me as there is only one instance of the custom formula so each instance of HyperFormula shares the same instance of the custom formula.
I hope that makes more sense?