[haXe] best strategy to port an existing js library

Franco Ponticelli franco.ponticelli at gmail.com
Fri Dec 7 18:26:01 CET 2007


I've tried to add a constructor and it works but the __js__ can be removed
... the output is exactly the same in this case.
Why the someOtherFunctionWhichReturnsSomething function is there?

On Dec 7, 2007 5:22 PM, Franco Ponticelli <franco.ponticelli at gmail.com>
wrote:

> You are cheating ;-) Your methods are not static. And if I want to use
> them in an instance I can't because there is no constructor. Which way is
> the one you wanted to develop?
>
>
> On Dec 7, 2007 5:13 PM, Danny Wilson < danny at decube.net> wrote:
>
> > 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
> >
> >
> > --
> > haXe - an open source web programming language
> > http://haxe.org
> >
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.motion-twin.com/pipermail/haxe/attachments/20071207/d66049e4/attachment.htm


More information about the Haxe mailing list