Fantom

 

JavaScript

Overview

Fantom provides support for compiling to JavaScript and running in JavaScript VMs such as web browsers. Most of the sys API is available, however not all pods and APIs are accessible due to limitations of the JavaScript VM enviornment.

Js Facet

You must explictly mark types you intend to compile to JavaScript using the sys::Js facet:

@Js
class GonnaBeJs
{
  Void sayHi() { Win.cur.alert("Hello!") }
}

Natives

To compile JavaScript natives, add the source directories to your build script using the jsDirs field. See Build Pod for an example.