Platforms to show: All Mac Windows Linux Cross-Platform

JavaScriptEngineMBS class

Type Topic Plugin Version macOS Windows Linux iOS Targets
class JavaScript MBS Tools Plugin 20.0 ✅ Yes ✅ Yes ✅ Yes ✅ Yes All
The class for our embedded JavaScript engine.

We use DukTape, an embeddable Javascript engine, with a focus on portability and compact footprint.
https://duktape.org

Your own JavaScript engine is useful for:

  • Running some snippet of JavaScript code without HTMLViewer.
  • Using various JavaScript libraries
  • Providing a scripting language to your own application.
  • An lightweight alternative to XojoScript.
  • Working with JSON data
  • Enjoy using regular expressions, unicode text functions, number parsing and formatting with no platform dependencies

MBS Plugin added Input(), Yield() and Print() functions for your convenience.
Yield will pass CPU control to other threads, so background tasks continue to run.

MBS Plugin can convert JavaScript values to variant.
Boolean -> Boolean
Number -> Double
String -> String
Buffer -> MemoryBlock
Pointer -> Ptr
Array -> Variant array
Object -> JSON string
null -> nil

We convert variant to JavaScript:
nil -> null
Int32, Int64, Single, Double, Currency -> Number
Boolean -> Boolean
String, Text, Date -> String
Ptr -> Pointer
all other -> undefined

This class is like XojoScript, but using JavaScript as language.

Warning: error handling is broken in version 21.1 of the MBS Plugin. Please update to 22.2 for a fix.

This class has no sub classes.

Some examples using this class:

Blog Entries

Xojo Developer Magazine

Videos

Release notes


The items on this page are in the following plugins: MBS Tools Plugin.


JavaScriptEngineExceptionMBS   -   JavaShortArrayMBS


The biggest plugin in space...