Rhino JavaScript Engine
As of v.8.5, ThingWorx uses version 1.7.11 of the Rhino.JavaScript Engine. Rhino includes all features of JavaScript 1.7 and some support for JavaScript 1.8 features. It also provides the following general capabilities/tools:
• Direct scripting of Java
• JavaScript shell
• JavaScript compiler
• JavaScript debugger
JavaScript 1.7 is the default version in the Rhino shell. The JavaScript language is controlled by the ECMA-262 ECMAScript standard, which is a general purpose, cross-platform programming language. Rhino 1.3 and greater conform to edition 3 of the standard. Rhino 1.6 and greater implement ECMA-357 ECMAScript for XML (E4X). For more information on the Rhino standard, release notes, and implementation, see the
https://developer.mozilla.org site.
|
Rhino does not support the additional arguments in the localeCompare JavaScript service in ThingWorx. It only verifies the first argument of the service because localeCompare is not a standard function in the ECMA-262 ECMAScript standard.
|
|
Const variables are not block-scoped, instead they are function-scoped. Use let instead of const.
|
Global Built-in Prototypes Locked Down
In general, it is not recommended to modify built-in prototype objects, such as Array.prototype or String.prototype. Because these objects reside in the shared base scope used for all script executions, modifying them can have serious consequences. For this reason, as of v.8.5, prototype objects are locked down on the ThingWorx platform.