You could use something like (sometimes called monkey-patching):
var oldStep = Fx.prototype.step;
Fx.implement('step', function(){
// do what you want
oldStep.apply(this, arguments);
});
Or use Class.refactor from MooTools More:
http://mootools.net/docs/more/Class/Class.Refactor
Be aware that this method is called a lot (60 fps) so make sure you're not
doing any heavy stuff. Also using this monkey-patching or using
Class.refactor too much might make your code a bit brittle.
On Tue, Aug 2, 2011 at 2:39 PM, Philip Thompson <[email protected]>wrote:
> I know this may not fully help you, but I was able to extend a non-base Fx
> class...
>
> http://jsfiddle.net/philthathril/nHShL/
>
> It kinda seems like a bug to me that you can implement a method in the base
> class, but I'm sure there's some reason.
>
> Hope it helps,
> ~Philip
>
>
> On Tue, Aug 2, 2011 at 8:10 AM, Korbinian Moser <
> [email protected]> wrote:
>
>> Hi, I want to implement a step event to the Fx base class.
>> Sadly, this doesn't work:
>>
>> Fx.implement(
>> {
>> step: function(now)
>> {
>> this.parent.step(now);
>> this.fireEvent( 'step');
>> }
>> });
>>
>> Doing it that way, this.parent is undefined.
>> Taking the original function from an instance causes an endless loop of
>> implementations.
>> Is there a way to access the original function without copying all its
>> code here?
>>
>
>
>
> --
> http://lonestarlightandsound.com/
>