I need to implement a call from scala.js a method like:
sigma.classes.graph.addMethod('getNodesCount', function() {
return this.nodesArray.length;
});
that is the way that bring the library in JS to access the internal array nodesArray of the class sigma.clasess.graph. I tried something like
trait GraphClassesJS extends js.Object {
def addMethod(name:String,handler: js.Function0[Any]):Unit=js.native
}
I try to call with
s.classes.graph.addMethod("getNodesCount",()=>js.ThisFunction.nodesArray.length)
but I get
value nodesArray is not a member of object scala.scalajs.js.ThisFunction
[error] s.classes.graph.addMethod("getNodesCount",()=>js.ThisFunction.nodesArray.length)
How can I do it? Thanks Reynaldo