I'd like to load and use a .js library with the base_element plugin.
So, how to do it ?
This function doesn't really work that way since it has no GUI controls. If you want to do that type of thing you should be using a webviewer to load it.
I've read (via Tod Geist), that this plugin uses duktape. And ducktape 1.0 could loud js, with the require function. But Duktape 2.0 has it off by default.
I tried, but it failed but not sure it fails due to that 2.0 thing or if that's because I messed up the path.
Sure there's a lot of .js library that would need the GUI, but they're some that are purely math
And, the webwiewer based approach won't run server side
Vincent_L wrote in whole or in part:And, the webwiewer based approach won't run server side
Vincent_L wrote in whole or in part:
Are you using this with Web Direct or other things that prevent "server side"?
You can host your own code file somewhere then use Insert From URL to insert the resulting rendered HTML into a text field. If you make the result JSON you can even grab this now and use it with the new FM16 JSON functions.
There's always ways to do it, but the plugin as noted has some shortcomings since it isn't really browser or web server executed. It's essentially emulated.
I ran into this exact same problem. I ended up rewriting all of my code using only native JS functions.
How do you pass the code to the BE_Plugin ? Just as a big string ?
My hope is that BE could support Duktape's require function
Don't understand. Webviewer itself is not server side supported. I wan my code to run as a server side schedul, which precludes any webviewer stuff unfortunately
Ok. Thank you for the update. I did not see that information in OP.
You have to be careful because the Ducktape engine doesn't support carriage returns in variables, so I substitute for a different character and then split on that character in my code:
obviously you're more JS savvy than I am.
In fact we do not know if BE's Duktape is v.1.0 or 2.0, or if it has the require module or not
Maybe you could try to make it work.
I was able to get a not callable error, so maybe support is here, but due to my limited JS knowledge I couldn't understand this
and also, maybe I wan't able to figure out a proper file path
Maybe your JS knowledge could work this out
What are you ultimately trying to do? Your best bet is to try to get it to work without any libraries.
Retrieving data ...