[haXe] best strategy to port an existing js library

Danny Wilson danny at decube.net
Fri Dec 7 18:40:57 CET 2007


>    /** Static call **/
>    public static function niceAlert(txt:String):Void = untyped  
> __js__("niceAlert");
>
Wow what just happened, that's not even possible :D


This will:

class MyWrappingClass
{
   static function __init__()
   {
     untyped MyWrappingClass.niceAlert = __js__("niceAlert");
   }

   /** Static call **/
   public static function niceAlert(txt:String):Void;

}

ofcourse you can wrap it in:

static var niceAlert : Void->Void;

But then you won't get any argument names when it's autocompleted, and the  
generated haxedoc will be less nice :-)


Kind regards,

      Danny Wilson


deCube.net - http://decube.net/
web application design and development




More information about the Haxe mailing list