0

fire a event from qooxdoo, how should I do?

ClassA dispatches the event A of type MyEvent and ClassB listens for that event. Then classB dispatches the same event B of type MyEvent with the same data.. In classB I've made this:

        var target = evt.getTarget();
        this.fireEvent("A", MyEvent, [target])

but I'm repeating code, it's possible to do it more automated?

thanks a lot

Totty.js
  • 15,563
  • 31
  • 103
  • 175

1 Answers1

0

I guess you could enclose this logic inside a qooxdoo global variable and then just call the variable as a function:

var standardEvent : function() {
    var target = evt.getTarget();
    this.fireEvent("A", MyEvent, [target])
}

and the call it in your subclasses:

qx.core.Init.getApplication().standardEvent();

You'd have to figure out the scope, though.

E_lexy
  • 141
  • 6
  • I think doing some bubbling like qooxdoo does in it's UI components might be good, but I didn't yet looked into that matter... What do you think? – Totty.js Jan 11 '13 at 14:19