How do I override a core method (in Javascript)?

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

How do I override a core method (in Javascript)?

singmajesty
Hi!

I want to override "Reflect.setField", but I can't since it isn't marked  
as dynamic.

Does anyone know how this could be possible?

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I override a core method (in Javascript)?

singmajesty
Nevermind, I got it.

It might be cool if Haxe could use Javascript getters and setters for  
Javascript in the future!

In the meantime, NME publishes its own modified copy of the Reflect class  
when publishing for HTML5, which checks for Jeash getter and setter methods



On Wed, 21 Sep 2011 12:04:11 -0700, Joshua Granick  
<[hidden email]> wrote:

> Hi!
>
> I want to override "Reflect.setField", but I can't since it isn't marked  
> as dynamic.
>
> Does anyone know how this could be possible?

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I override a core method (in Javascript)?

Franco Ponticelli
In the meantime, NME publishes its own modified copy of the Reflect class when publishing for HTML5, which checks for Jeash getter and setter methods

I suggest adding the new keyword "native" for properties in haXe 3.0. What do you think?

Franco

--
haXe - an open source web programming language
http://haxe.org
Reply | Threaded
Open this post in threaded view
|

Re: How do I override a core method (in Javascript)?

Benjamin Dasnois
Hello,

If the function is declared as dynamic you may want to store the "old" function somewhere and then set your own. This way, you can intercept all calls, eventually do things before and after the old function or just execute your own or the old depending on some information.

Regards,

On Thu, Sep 22, 2011 at 9:28 AM, Franco Ponticelli <[hidden email]> wrote:
In the meantime, NME publishes its own modified copy of the Reflect class when publishing for HTML5, which checks for Jeash getter and setter methods

I suggest adding the new keyword "native" for properties in haXe 3.0. What do you think?

Franco

--
haXe - an open source web programming language
http://haxe.org



--
DASNOIS Benjamin
http://www.benjamindasnois.com

--
haXe - an open source web programming language
http://haxe.org