-
Notifications
You must be signed in to change notification settings - Fork 5
Javascript api
Basics of the Javascript environment behind the js-eden interface.
- Accessing Symbols
- Scripts - Execution and Loading
- Loading and Configuring Plugins
Observables, functions and procedures are represented as JavaScript objects that are stored in a symbol table. The symbol table can be found at root.symbols. To access a specific symbol you need to give its name: root.symbols["_status"]. It is advisable to limit direct JavaScript interaction with the symbol table to the reading and writing of observable values. More complex interactions are best done via the Eden scripting language.
root.symbols["_status"].value() returns the current value of the observable. Do not directly use the internal cached_value property as that may not be up-to-date.
root.symbols["_status"].assign("New Status") changes the value and will trigger any required dependency maintenance. Again, do not directly change cached_value.
Eden.executeFileSSI(path) will ask the server to perform a server-side include of all scripts that might be included by the specified script. A large single script is then returned and processed locally. The benefit of this is that there are fewer requests being made to the server and few separate scripts to process.
Eden.execute(string) will interpret the string as Eden and execute it.
eden.loadPlugin(name) will load an already installed plugin which will then make new views available. A list of available plugins can be found in Eden.plugins and a list of already loaded plugins can be found in eden.plugins. Note the upper and lower case "e" is important. Plugins sometimes have configurable options, these can be found in eden.plugins[name].