Components | All | New | MacOS | Windows | Linux | iOS | ||||
Examples | Mac & Win | Server | Client | Guides | Statistic | FMM | Blog | Deprecated | Old |
JS.New
Creates a new JavaScript engine instance.
Component | Version | macOS | Windows | Linux | Server | iOS SDK |
JavaScript | 10.0 | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes | ✅ Yes |
MBS( "JS.New" { ; JSRef } ) More
Parameters
Parameter | Description | Example | Flags |
---|---|---|---|
JSRef | Available in MBS FileMaker Plugin 11.3 or newer. The desired js reference. Usually each one gets a number assigned, but you can create a JavaScript environment with a fixed name, so you can anywhere reference it by name. |
"JS" | Optional |
Result
Returns JS reference number or error.
Description
Creates a new JavaScript engine instance.This object contains all the functions and properties you defined.
Please release the object later with the JS.Release function.
Your own JavaScript engine is useful for:
- Running some snippet of JavaScript code without web viewer.
- Using various JavaScript libraries
- Providing a scripting language to your own solution.
- Doing JavaScript on server side.
- Working with JSON data
- Enjoy using regular expressions, unicode text functions, number parsing and formatting with no platform dependencies
If JSRef is "js", we use this one as the global JavaScript engine for custom functions and JS.CF function. See our example JavaScript Custom Functions.
When using a name for the reference number, you can use this reference anywhere you need to pass a JavaScript reference number.
Check also our JavaScriptWebKit functions for using WebKit’s JavaScript engine on macOS and iOS.
Examples
Evaluate a bit of JavaScript:
Set Variable [ $js ; Value: MBS( "JS.New" ) ]
Set Variable [ $r ; Value: MBS( "JS.Evaluate"; $js; "4+5") ]
Show Custom Dialog [ "Result" ; $r ]
Set Variable [ $r ; Value: MBS( "JS.Release"; $JS ) ]
Create named JavaScript Environment:
Set Variable [$js; MBS( "JS.New"; "js" ) ]
See also
- JS.AddFileMakerSQLFunction
- JS.AddFunction
- JS.CallFunction
- JS.CF
- JS.GetGlobalProperty
- JS.InitModules
- JS.Now
- JS.ObjectCount
- JS.TimeToUTCDate
- JS.UTCDateToTime
Release notes
- Version 11.3
- Added parameter for JS.New function to define the identifier used for the new instance.
Example Databases
- JavaScript/CoordinatDistance
- JavaScript/FM JSON Path
- JavaScript/JavaScript Custom Functions
- JavaScript/JavaScript libPhoneNumber
- JavaScript/JavaScript SunCalc
- JavaScript/JavaScript
- JavaScript/RichTextToJSON
- List/Sort Benchmark
Blog Entries
- New in MBS FileMaker Plugin 11.3
- Neues MBS FileMaker Plugin 11.3
- MBS FileMaker Plugin 11.3 - More than 6500 Functions In One Plugin
- Custom Functions in JavaScript
- MBS FileMaker Plugin, version 11.3pr2
- New in the MBS FileMaker Plugin 10.1
- FileMaker and JavaScript - the perfect combination
- New in the MBS FileMaker Plugin 10.0
- CRC function in FileMaker using JavaScript
- Our JavaScript engine for FileMaker
FileMaker Magazin
This function checks for a license.
Created 7th December 2019, last changed 4th July 2024