I did look in the docs, and didn’t find the info I was looking for…and, the Rhino engine does support these advanced javascript options.
In fact, it appears that Servoy does, as well – just the editor doesn’t, which is understandable since Servoy handles the actual function declarations.
If you put your code in a text file, read it in and eval it, it’ll work. Try this:
var s = plugins.file.readTXTFile();
application.output(s);
eval(s);
application.output( boo() );
var str = "test";
application.output( str.boo() );
(the content of the js file is included in the output)
Now, that said, doing this could be a security/deployment issue. And I don’t know enough about the mechanics of the Javascript implementation in Servoy to know if doing this at startup would make these methods globally available, etc…but I’m very interested in pursing more information on the options here.
agiletortoise:
I did look in the docs, and didn’t find the info I was looking for…and, the Rhino engine does support these advanced javascript options.
In fact, it appears that Servoy does, as well – just the editor doesn’t, which is understandable since Servoy handles the actual function declarations.
agiletortoise:
Can we extend javascript objects with prototypes?
Yes you can, if something is not allowed it will let you know, we locked/sealed several object which are not open for prototyping like the “forms” object.
agiletortoise:
Can we define/use anonymous functions?
Yes you could, if Rhino did not have a issue with anonymous functions, we prevent you from using the function keyword for this reason. Servoy 4.0 will have the latest Rhino, I suppose the issue is resolved in there.