many thanks for that kangax, will definitely look at your AOP stuff.

On Jan 21, 1:34 am, kangax <[EMAIL PROTECTED]> wrote:
> We are using a very simple AOP implementation (that Samuel Lebeau has
> come up with) in Prototype 
> UI.http://i.gotfresh.info/2007/12/7/advised-methods-for-javascript-with-...
>
> One relevant problem we are facing is how inconvenient it is to fire
> certain framework-level events. In the following example, we can't
> fire custom event ('component:initialized') from within parent
> constructor as it would lose all the semantic in a subclass. Letting
> subclasses fire events on their own (as an alternative solution) just
> doesn't feel quite right. I'm guessing the best way would be to
> augment Class.create to "wrap" constructors, yet handle $super calls
> properly.
>
> UI.Component = Class.create(UI.Observable, {
>   initialize: function(element) {
>     this.element = element;
>     // ... do some initialization
>     this.fire(this.componentId + ':initialized');
>   }
>
> })
>
> UI.Menu = Class.create(UI.Component, {
>   initialize: function($super, element) {
>     $super(element); // <= event is fired from within parent, royally
> messing things up
>     ...
>     // <= need to be fired in the end of execution
>   }
>
> })
>
> Best,
> kangax
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to