When to use fireNonBubblingEvent?

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

When to use fireNonBubblingEvent?

marv
When to use fireNonBubblingEvent?

Hi,

 

In what cases should one use fireNonBubblingEvent() instead of fireEvent()? I saw it used in the qx.ui.window.Window class:

    close : function()
    {
      if (!this.isVisible()) {
        return;
      }
 
      if (this.fireNonBubblingEvent("beforeClose", qx.event.type.Event, [false, true]))
      {
        this.hide();
        this.fireEvent("close");
      }
    },

 

But I do not really understand why a non bubbling event is preferred here.

 

Thanx.

 

Regards,

Martijn.


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122712
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

Richard Sternagel
Hi Martijn,

I would use it if you don't want bubbling! ;)

In this special case I can't tell you why back then (4-5 years ago) this
was preferred. I can only think of general advantages:

- I would expect a slightly performance gain
- you are also preventing that the DOM Node parent chain upwards reacts
on that event which you may not want (if you are using this event
frequently in your application)

Regards
Richard

Am 17.01.13 17:30, schrieb Martijn Verbrugh:

> Hi,
>
> In what cases should one use fireNonBubblingEvent() instead of
> fireEvent()? I saw it used in the qx.ui.window.Window class:
>
>      close : function()
>      {
>        if (!this.isVisible()) {
>          return;
>        }
>        if (this.fireNonBubblingEvent("beforeClose", qx.event.type.Event,
> [false, true]))
>        {
>          this.hide();
>          this.fireEvent("close");
>        }
>      },
>
> But I do not really understand why a /non bubbling/ event is preferred here.
>
> Thanx.
>
> Regards,
>
> Martijn.
>


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

Dietrich Streifert
Hi Richard,

does fireing a non DOM related event (e.g. changeValue for ComboBox)
make any sense with bubbling?

Regards
Dietrich

Am 18.01.2013 13:39, schrieb Richard Sternagel:

> Hi Martijn,
>
> I would use it if you don't want bubbling! ;)
>
> In this special case I can't tell you why back then (4-5 years ago) this
> was preferred. I can only think of general advantages:
>
> - I would expect a slightly performance gain
> - you are also preventing that the DOM Node parent chain upwards reacts
> on that event which you may not want (if you are using this event
> frequently in your application)
>
> Regards
> Richard
>
> Am 17.01.13 17:30, schrieb Martijn Verbrugh:
>> Hi,
>>
>> In what cases should one use fireNonBubblingEvent() instead of
>> fireEvent()? I saw it used in the qx.ui.window.Window class:
>>
>>       close : function()
>>       {
>>         if (!this.isVisible()) {
>>           return;
>>         }
>>         if (this.fireNonBubblingEvent("beforeClose", qx.event.type.Event,
>> [false, true]))
>>         {
>>           this.hide();
>>           this.fireEvent("close");
>>         }
>>       },
>>
>> But I do not really understand why a /non bubbling/ event is preferred here.
>>
>> Thanx.
>>
>> Regards,
>>
>> Martijn.
>>
>
> ------------------------------------------------------------------------------
> Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
> much more. Get web development skills now with LearnDevNow -
> 350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
> SALE $99.99 this month only -- learn more at:
> http://p.sf.net/sfu/learnmore_122812
> _______________________________________________
> qooxdoo-devel mailing list
> [hidden email]
> https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

Richard Sternagel
It depends.

"Some types of events will bubble up the parent widget chain (such as
mouse events, ...) while others are only fired on the original object
(e.g. property changes, ...)." [1]

AFAIK there is no written down list which states which events support it
and which not. Just try it out in a small sample app.

Regards
Richard

[1] http://manual.qooxdoo.org/current/pages/desktop/ui_interaction.html

Am 18.01.13 14:37, schrieb Dietrich Streifert:
> Hi Richard,
>
> does fireing a non DOM related event (e.g. changeValue for ComboBox)
> make any sense with bubbling?
>
> Regards
> Dietrich


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

Dietrich Streifert
What kind of event is fired if I have a property bound event like this:

     value :
     {
       check : "String",
       event : "changeValue",
       init : null,
       nullable : true
     }

Bubbling or non-bubbling?

The event is automatically fired by some (more or less) hidden logic
within qooxdoo.

I have some huge forms with a lot dependencies between the form fields
which are triggered via the changeValue and changeModel events.

This may be something to look into because of possible performance gains
especially on IE8.

Regards
Dietrich


Am 18.01.2013 16:39, schrieb Richard Sternagel:

> It depends.
>
> "Some types of events will bubble up the parent widget chain (such as
> mouse events, ...) while others are only fired on the original object
> (e.g. property changes, ...)." [1]
>
> AFAIK there is no written down list which states which events support it
> and which not. Just try it out in a small sample app.
>
> Regards
> Richard
>
> [1] http://manual.qooxdoo.org/current/pages/desktop/ui_interaction.html
>
>


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

marv
RE: [qooxdoo-devel] When to use fireNonBubblingEvent?

@Richard: thanx for your answer. As for the performance penalty: is the bubbling process taken care of by qooxdoo or by the browser?

 

@Dietrich: according to the documentation dataEvents are non-bubbling:

          "fireDataEvent() Creates and dispatches an non-bubbling data event on this object."

The event set for class properties are of this type.

 

Regards,

Martijn.

 

-----Oorspronkelijk bericht-----
Aan: qooxdoo Development <[hidden email]>;
Van: Dietrich Streifert <[hidden email]>
Verzonden: vr 18-01-2013 17:35
Onderwerp: Re: [qooxdoo-devel] When to use fireNonBubblingEvent?
What kind of event is fired if I have a property bound event like this:

    value :
    {
      check : "String",
      event : "changeValue",
      init : null,
      nullable : true
    }

Bubbling or non-bubbling?

The event is automatically fired by some (more or less) hidden logic
within qooxdoo.

I have some huge forms with a lot dependencies between the form fields
which are triggered via the changeValue and changeModel events.

This may be something to look into because of possible performance gains
especially on IE8.

Regards
Dietrich


Am 18.01.2013 16:39, schrieb Richard Sternagel:

> It depends.
>
> "Some types of events will bubble up the parent widget chain (such as
> mouse events, ...) while others are only fired on the original object
> (e.g. property changes, ...)." [1]
>
> AFAIK there is no written down list which states which events support it
> and which not. Just try it out in a small sample app.
>
> Regards
> Richard
>
> [1] http://manual.qooxdoo.org/current/pages/desktop/ui_interaction.html
>
>


------------------------------------------------------------------------------
Master HTML5, CSS3, ASP.NET, MVC, AJAX, Knockout.js, Web API and
much more. Get web development skills now with LearnDevNow -
350+ hours of step-by-step video tutorials by Microsoft MVPs and experts.
SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122812
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel

 


------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. SALE $99.99 this month only -- learn more at:
http://p.sf.net/sfu/learnmore_122412
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel
Reply | Threaded
Open this post in threaded view
|

Re: When to use fireNonBubblingEvent?

Dietrich Streifert
Hi Martijn,

now this is clear.

Thank you for your help.

Regards
Dietrich

Am 21.01.2013 13:13, schrieb Martijn Verbrugh:
RE: [qooxdoo-devel] When to use fireNonBubblingEvent?

@Richard: thanx for your answer. As for the performance penalty: is the bubbling process taken care of by qooxdoo or by the browser?

 

@Dietrich: according to the documentation dataEvents are non-bubbling:

          "fireDataEvent() Creates and dispatches an non-bubbling data event on this object."

The event set for class properties are of this type.

 

Regards,

Martijn.

 




------------------------------------------------------------------------------
Master Visual Studio, SharePoint, SQL, ASP.NET, C# 2012, HTML5, CSS,
MVC, Windows 8 Apps, JavaScript and much more. Keep your skills current
with LearnDevNow - 3,200 step-by-step video tutorials by Microsoft
MVPs and experts. ON SALE this month only -- learn more at:
http://p.sf.net/sfu/learnnow-d2d
_______________________________________________
qooxdoo-devel mailing list
[hidden email]
https://lists.sourceforge.net/lists/listinfo/qooxdoo-devel