[haXe] best strategy to port an existing js library

Danny Wilson danny at decube.net
Fri Dec 7 18:13:06 CET 2007


Let's do some proper haXe magic here:

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

   public function niceAlert(txt:String); // Returns void
   public function  
someOtherFunctionWhichReturnsSomething(txt:String):ReturnType
   {return null;} // To trick haxe compiler :-(
}

That should work fairly well...

Or maybe you could just wrap the functions in a javascript class (not  
haxe), then write an extern class definition in haxe.

Also take a look at:
   http://hxbase.googlecode.com/svn/trunk/src/GoogleMapsExtern.hx
   http://hxbase.googlecode.com/svn/trunk/src/hxbase/publicapi/googlemaps/GoogleMaps.hx

Kind regards,

      Danny Wilson


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




More information about the Haxe mailing list