Edit this page Backlinks Add to book Export to PDF Book Creator Add this page to your book Book Creator Remove this page from your book Manage book (0 page(s)) Help Script Interface Plugin General The Script Interface Plugin enables you to write Scripts in the JavaScript language to program CoDaBix. Scripts are lightweight extensions of CoDaBix. A fast and simple (yet powerful) way to extend CoDaBix's functionality Implemented in JavaScript which is a powerful scripting language, and TypeScript to avoid errors by providing static typing and to offer a rich developer experience Can be changed and restarted while CoDaBix is running Stored in the CoDaBix back-end database, so it is bound to the data, not to the installation Executed in an isolated environment, has only access to certain defined CoDaBix APIs, not OS APIs No need to install an development environment, create a project, compile it, copy the DLL, etc. … Instead, simply write the script in the built-in and web-based Script Editor with IntelliSense support What Does the Plugin Do? Find, create and manipulate Nodes and read and write Node values Register for events, e.g. when a Node value has been written Do calculations, call mathematic functions, generate a random number Create an interval timer that continuously calls back a script function Read and write files Handle incoming HTTP(S) requests of the CoDaBix web server (including WebSocket connections) Execute HTTP(S) requests to external servers If you have basic programming experience, you should be able to easily find your way when writing code of a script. JavaScript is one of the most popular scripting languages and in combination with TypeScript (that provides static type safety), a script can scale from a one-liner (e.g. adjust a Node value before it is written) to complex code with namespaces, classes, dependencies on other scripts and further more. Note: You don't need to be familiar with TypeScript to be able to write scripts. Features High performance by compiling script code to CIL bytecode Type safety of variables, properties and so on through TypeScript Protects against unintended infinite loops by applying a timeout to script execution Supported Specifications Support for TypeScript 4.1 in the Script Editor Full support for ECMAScript 5.1 (syntax and library) Almost full support for ECMAScript 2015+ syntax (let / const, class, for-of, async / await etc.) by downlevel compilation to ECMAScript 5.1 using TypeScript Partial support for ECMAScript 2015 library (Collections, Typed Arrays, Promise) Supports Async Functions for long-running operations using the async / await keywords (enhancing JavaScript's event-driven, non-blocking model) Purpose & Use Cases You can use scripts for simple circuitries (“When a button is pressed, the light shall be turned on and after 3 minutes be turned off”) adjusting values that are read from or written to a device, e.g. by doing some calculations generating complex Node hierarchies / structures generating demo data (e.g. write a random value to a Node every 2 seconds) big data: collect external data around specific points, e.g. store Berlin's current weather in a datapoint Node providing a complex, customized condition for triggers Script Interface Plugin Development Guide You can find the Development Guide to the Script Interface Plugin here: Script Interface Plugin Development Guide You can find the Development Guide to the Script Interface Plugin here: Script Interface Plugin Development Guide Installation The Script Interface Plugin is an inherent part of CoDaBix and does not need to be installed. Configuration The Script Interface Plugin allows to configure Scripts in the CoDaBix Web Configuration using the “Script Interface” menu entry - see Managing Scripts in the Script Interface Plugin Development Guide. The Script Interface Plugin allows to configure Scripts in the CoDaBix Web Configuration using the “Script Interface” menu entry - see Managing Scripts in the Script Interface Plugin Development Guide. Diagnostics The Script Interface Plugin allows to diagnose Scripts in the CoDaBix Web Configuration using the “Script Interface” menu entry - see Managing Scripts in the Script Interface Plugin Development Guide. The Script Interface Plugin allows to diagnose Scripts in the CoDaBix Web Configuration using the “Script Interface” menu entry - see Managing Scripts in the Script Interface Plugin Development Guide. Entities The Script Interface Plugin does not use the CoDaBix Entity Model because it allows Scripts to be managed using the CoDaBix Web Configuration and therefore doesn't provide entities. Folders & Files The Script Interface Plugin is an inherent part of CoDaBix and therefore doesn't consist of additional files or folders. About Versions This Document Date 2017-11-14 Version 1.8 Plugin Name Script Interface Plugin Version Corresponds to the CoDaBix Version Assembly The Script Interface Plugin is an inherent part of CoDaBix and therefore doesn't consist of a separate assembly. Table of Contents General What Does the Plugin Do? Features Supported Specifications Purpose & Use Cases Installation Configuration Diagnostics Entities Folders & Files About Versions