FrameScripts are a way for users to create custom interactivity and content inside their Frame through a scripting interface.  FrameScript is intended to look and feel like JavaScript but they are very different.  Many JavaScript language features are not supported. For example, currently there is no class support.

We also hope that developers are able to weave in code from Babylon.js, the 3D development framework from Microsoft that we use to build Frame.

In this first iteration of FrameScript (FS), only one global script is supported.  When a user connects to your Frame, the script will be evaluated and your code will execute.

Most interactions and creation methods will require use of functions we expose to you.  No document scope or window scope are accessible through Frame Scripts.

We definitely recommend using this documentation alongside the general Babylon.js documentation. Just keep in mind that while many things from Babylon.js will work just fine, the entirety of Babylon.js functions aren’t yet available to Frame Scripts. If there’s something you want that isn’t supported yet, let us know!

Available Functions

**console.log(…args:any)**

This allows users to log any value to the documents console. Can be comma separated.


**Math.min(a: number, b: number)**

Returns the minimum numeric value out of the provided values.


Math.max(a: number, b: number)

Returns the maximum numeric value out of the provided values.


Math.sin(delta: number)

Exposes the JavaScript Math.sin method.