You can even do something like:
package my.custom.code;
@:native("MyCustomCode")
extern class MyCode {
public static function alert (message:String):Void;
public static function otherMethod ():Void;
}
then
import my.custom.code.MyCode;
...
MyCode.alert ("Hello");
turns into
MyCode.alert ("Hello");
in the final output. The @:native
meta is optional – use it if your package + class name is different than what the JavaScript object reference is. This is a type-safe way of using JavaScript. For example, we do extern classes for using Howler.js in Lime: