Is there a way to cancel a specific effect? For instance; Effects are added to the queue. Before actually processing the effect, I''d like to check a condition & cancel the effect if necessary. Here''s the code excerpt: var menu = { toggleText: function(element,toggle) { var vis = $(element+''Text'').visible(); if (toggle && !vis) { // toggle text ON new Effect.BlindDown(element+''Text'', {queue: {scope: ''headers'', position:''front''}}); } else if (!toggle && vis && this.currentHeader != element) { new Effect.BlindUp( element+''Text'', { queue: {scope: ''headers'', position:''end''}, beforeStart: function() { if (menu.currentHeader == element) { this.cancel(); } } }); } }, I''m not sure that this.cancel(); cancels the effect, nor that the comparisson (currentHeader == element) remains static to the original element the Effect was called for. Any ideas? Thanks, ~ Brice Burgess
var myEffect = new Effect.effectName( effectOptions ); myEffect.cancel(); For real time answers and more, check out effects.js and look under Effect.base and Effect.theEffectYouWantToLearnAbout -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Brice Burgess Sent: Monday, May 22, 2006 3:38 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Canceling a specific effect Is there a way to cancel a specific effect? For instance; Effects are added to the queue. Before actually processing the effect, I''d like to check a condition & cancel the effect if necessary. Here''s the code excerpt: var menu = { toggleText: function(element,toggle) { var vis = $(element+''Text'').visible(); if (toggle && !vis) { // toggle text ON new Effect.BlindDown(element+''Text'', {queue: {scope: ''headers'', position:''front''}}); } else if (!toggle && vis && this.currentHeader != element) { new Effect.BlindUp( element+''Text'', { queue: {scope: ''headers'', position:''end''}, beforeStart: function() { if (menu.currentHeader == element) { this.cancel(); } } }); } }, I''m not sure that this.cancel(); cancels the effect, nor that the comparisson (currentHeader == element) remains static to the original element the Effect was called for. Any ideas? Thanks, ~ Brice Burgess _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I haven''t tested this, but I believe the beforeStart function takes a parameter of the effect. So your beforeStart function should look like: beforeStart: function(effect) { if (menu.currentHeader == element) { effect.cancel(); } } hope this helps Nicholas On 5/22/06, Brice Burgess <bhb-q0spLWLYtkPR7s880joybQ@public.gmane.org> wrote:> Is there a way to cancel a specific effect? For instance; Effects are > added to the queue. Before actually processing the effect, I''d like to > check a condition & cancel the effect if necessary. > > Here''s the code excerpt: > var menu = { > toggleText: function(element,toggle) { > var vis = $(element+''Text'').visible(); > if (toggle && !vis) { // toggle text ON > new Effect.BlindDown(element+''Text'', {queue: {scope: > ''headers'', position:''front''}}); > } > else if (!toggle && vis && this.currentHeader != element) { > new Effect.BlindUp( > element+''Text'', > { > queue: {scope: ''headers'', position:''end''}, > beforeStart: function() { > if (menu.currentHeader == element) { > this.cancel(); > } > } > }); > } > }, > > I''m not sure that this.cancel(); cancels the effect, nor that the > comparisson (currentHeader == element) remains static to the original > element the Effect was called for. > > Any ideas? > > Thanks, > > ~ Brice Burgess > > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >-- DCRails.com || Making the Metrorail fun!
Wouldn''t you need to do effect.element? Just element by itself probably is not referring to what you think it is. Greg> -----Original Message----- > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org[mailto:rails-spinoffs-> bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Nicholas Schlueter > Sent: Monday, May 22, 2006 4:33 PM > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > Subject: Re: [Rails-spinoffs] Canceling a specific effect > > I haven''t tested this, but I believe the beforeStart function takes a > parameter of the effect. > > So your beforeStart function should look like: > beforeStart: function(effect) { > if (menu.currentHeader == element) { > effect.cancel(); > } > } > > hope this helps > Nicholas > > On 5/22/06, Brice Burgess <bhb-q0spLWLYtkPR7s880joybQ@public.gmane.org> wrote: > > Is there a way to cancel a specific effect? For instance; Effectsare> > added to the queue. Before actually processing the effect, I''d liketo> > check a condition & cancel the effect if necessary. > > > > Here''s the code excerpt: > > var menu = { > > toggleText: function(element,toggle) { > > var vis = $(element+''Text'').visible(); > > if (toggle && !vis) { // toggle text ON > > new Effect.BlindDown(element+''Text'', {queue: {scope: > > ''headers'', position:''front''}}); > > } > > else if (!toggle && vis && this.currentHeader != element) { > > new Effect.BlindUp( > > element+''Text'', > > { > > queue: {scope: ''headers'', position:''end''}, > > beforeStart: function() { > > if (menu.currentHeader == element) { > > this.cancel(); > > } > > } > > }); > > } > > }, > > > > I''m not sure that this.cancel(); cancels the effect, nor thatthe> > comparisson (currentHeader == element) remains static to theoriginal> > element the Effect was called for. > > > > Any ideas? > > > > Thanks, > > > > ~ Brice Burgess > > > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > -- > DCRails.com || Making the Metrorail fun! > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I believe he is getting element from the original toggleText function parameter, but I really don''t know. I was just fixing the "this" problem. On 5/22/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote:> Wouldn''t you need to do effect.element? Just element by itself probably > is not referring to what you think it is. > > Greg > > > -----Original Message----- > > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > [mailto:rails-spinoffs- > > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Nicholas Schlueter > > Sent: Monday, May 22, 2006 4:33 PM > > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > Subject: Re: [Rails-spinoffs] Canceling a specific effect > > > > I haven''t tested this, but I believe the beforeStart function takes a > > parameter of the effect. > > > > So your beforeStart function should look like: > > beforeStart: function(effect) { > > if (menu.currentHeader == element) { > > effect.cancel(); > > } > > } > > > > hope this helps > > Nicholas > > > > On 5/22/06, Brice Burgess <bhb-q0spLWLYtkPR7s880joybQ@public.gmane.org> wrote: > > > Is there a way to cancel a specific effect? For instance; Effects > are > > > added to the queue. Before actually processing the effect, I''d like > to > > > check a condition & cancel the effect if necessary. > > > > > > Here''s the code excerpt: > > > var menu = { > > > toggleText: function(element,toggle) { > > > var vis = $(element+''Text'').visible(); > > > if (toggle && !vis) { // toggle text ON > > > new Effect.BlindDown(element+''Text'', {queue: {scope: > > > ''headers'', position:''front''}}); > > > } > > > else if (!toggle && vis && this.currentHeader != element) { > > > new Effect.BlindUp( > > > element+''Text'', > > > { > > > queue: {scope: ''headers'', position:''end''}, > > > beforeStart: function() { > > > if (menu.currentHeader == element) { > > > this.cancel(); > > > } > > > } > > > }); > > > } > > > }, > > > > > > I''m not sure that this.cancel(); cancels the effect, nor that > the > > > comparisson (currentHeader == element) remains static to the > original > > > element the Effect was called for. > > > > > > Any ideas? > > > > > > Thanks, > > > > > > ~ Brice Burgess > > > > > > _______________________________________________ > > > Rails-spinoffs mailing list > > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > > > > > > > > > -- > > DCRails.com || Making the Metrorail fun! > > _______________________________________________ > > Rails-spinoffs mailing list > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs > _______________________________________________ > Rails-spinoffs mailing list > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >-- DCRails.com || Making the Metrorail fun!
It seems that effect.cancel(); this.cancel(); , etc. don''t have an effect. I may look @ a different workaround / better queue system -- as I never want an active element (current element -- set via a onMouseOver) to become folded up -- and while rolling the mouse over several elements at once, and then stopping at one, it seems to roll it up (probably by a BlindUp effect in the queue stack) , and further -- sometimes the Blinded Up <div> never re-appears (even after waiting out all queued effects). If anyone would like, I could send the entire source .. although am going to sleep on this one for now ;) Thanks for the tips. ~ Brice Nicholas Schlueter wrote:> I believe he is getting element from the original toggleText function > parameter, but I really don''t know. I was just fixing the "this" > problem. > > On 5/22/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote: >> Wouldn''t you need to do effect.element? Just element by itself probably >> is not referring to what you think it is. >> >> Greg >> >> > -----Original Message----- >> > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> [mailto:rails-spinoffs- >> > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Nicholas Schlueter >> > Sent: Monday, May 22, 2006 4:33 PM >> > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > Subject: Re: [Rails-spinoffs] Canceling a specific effect >> > >> > I haven''t tested this, but I believe the beforeStart function takes a >> > parameter of the effect. >> > >> > So your beforeStart function should look like: >> > beforeStart: function(effect) { >> > if (menu.currentHeader == element) { >> > effect.cancel(); >> > } >> > } >> > >> > hope this helps >> > Nicholas >> > >> > On 5/22/06, Brice Burgess <bhb-q0spLWLYtkPR7s880joybQ@public.gmane.org> wrote: >> > > Is there a way to cancel a specific effect? For instance; Effects >> are >> > > added to the queue. Before actually processing the effect, I''d like >> to >> > > check a condition & cancel the effect if necessary. >> > > >> > > Here''s the code excerpt: >> > > var menu = { >> > > toggleText: function(element,toggle) { >> > > var vis = $(element+''Text'').visible(); >> > > if (toggle && !vis) { // toggle text ON >> > > new Effect.BlindDown(element+''Text'', {queue: {scope: >> > > ''headers'', position:''front''}}); >> > > } >> > > else if (!toggle && vis && this.currentHeader != element) { >> > > new Effect.BlindUp( >> > > element+''Text'', >> > > { >> > > queue: {scope: ''headers'', position:''end''}, >> > > beforeStart: function() { >> > > if (menu.currentHeader == element) { >> > > this.cancel(); >> > > } >> > > } >> > > }); >> > > } >> > > }, >> > > >> > > I''m not sure that this.cancel(); cancels the effect, nor that >> the >> > > comparisson (currentHeader == element) remains static to the >> original >> > > element the Effect was called for. >> > > >> > > Any ideas? >> > > >> > > Thanks, >> > > >> > > ~ Brice Burgess >> > > >> > > _______________________________________________ >> > > Rails-spinoffs mailing list >> > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > >> > >> > >> > -- >> > DCRails.com || Making the Metrorail fun! >> > _______________________________________________ >> > Rails-spinoffs mailing list >> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > >
This is more of a javascript question. I would like to know if there is a performance hit if variable/properties are accessed with many dots? Eg: Calling a method test() like Mandy.util.Error.test(); Vs Error.test(); Thanks in advance, Mandy.
Would it be better if I cached the object? eg: var E = Many.util.Error; E.test(); E.test2(); E.test3(); Instead of Mandy.util.Error.test(); Mandy.util.Error.test1(); Mandy.util.Error.test2(); Thanks, Mandy. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 12:59 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Minimizing dots for accessing properties This is more of a javascript question. I would like to know if there is a performance hit if variable/properties are accessed with many dots? Eg: Calling a method test() like Mandy.util.Error.test(); Vs Error.test(); Thanks in advance, Mandy. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
You need to use beforeStartInternal not beforeStart. Here is an example: <<effectCancelText.html>> Just drop it in the same directory as prototype.js and scriptaculous.js -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Brice Burgess Sent: Monday, May 22, 2006 9:34 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: Re: [Rails-spinoffs] Canceling a specific effect It seems that effect.cancel(); this.cancel(); , etc. don''t have an effect. I may look @ a different workaround / better queue system -- as I never want an active element (current element -- set via a onMouseOver) to become folded up -- and while rolling the mouse over several elements at once, and then stopping at one, it seems to roll it up (probably by a BlindUp effect in the queue stack) , and further -- sometimes the Blinded Up <div> never re-appears (even after waiting out all queued effects). If anyone would like, I could send the entire source .. although am going to sleep on this one for now ;) Thanks for the tips. ~ Brice Nicholas Schlueter wrote:> I believe he is getting element from the original toggleText function > parameter, but I really don''t know. I was just fixing the "this" > problem. > > On 5/22/06, Gregory Hill <Gregory_Hill-l9nu40+TWxQ@public.gmane.org> wrote: >> Wouldn''t you need to do effect.element? Just element by itself probably >> is not referring to what you think it is. >> >> Greg >> >> > -----Original Message----- >> > From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> [mailto:rails-spinoffs- >> > bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Nicholas Schlueter >> > Sent: Monday, May 22, 2006 4:33 PM >> > To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > Subject: Re: [Rails-spinoffs] Canceling a specific effect >> > >> > I haven''t tested this, but I believe the beforeStart function takes a >> > parameter of the effect. >> > >> > So your beforeStart function should look like: >> > beforeStart: function(effect) { >> > if (menu.currentHeader == element) { >> > effect.cancel(); >> > } >> > } >> > >> > hope this helps >> > Nicholas >> > >> > On 5/22/06, Brice Burgess <bhb-q0spLWLYtkPR7s880joybQ@public.gmane.org> wrote: >> > > Is there a way to cancel a specific effect? For instance; Effects >> are >> > > added to the queue. Before actually processing the effect, I''d like >> to >> > > check a condition & cancel the effect if necessary. >> > > >> > > Here''s the code excerpt: >> > > var menu = { >> > > toggleText: function(element,toggle) { >> > > var vis = $(element+''Text'').visible(); >> > > if (toggle && !vis) { // toggle text ON >> > > new Effect.BlindDown(element+''Text'', {queue: {scope: >> > > ''headers'', position:''front''}}); >> > > } >> > > else if (!toggle && vis && this.currentHeader != element) { >> > > new Effect.BlindUp( >> > > element+''Text'', >> > > { >> > > queue: {scope: ''headers'', position:''end''}, >> > > beforeStart: function() { >> > > if (menu.currentHeader == element) { >> > > this.cancel(); >> > > } >> > > } >> > > }); >> > > } >> > > }, >> > > >> > > I''m not sure that this.cancel(); cancels the effect, nor that >> the >> > > comparisson (currentHeader == element) remains static to the >> original >> > > element the Effect was called for. >> > > >> > > Any ideas? >> > > >> > > Thanks, >> > > >> > > ~ Brice Burgess >> > > >> > > _______________________________________________ >> > > Rails-spinoffs mailing list >> > > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > > >> > >> > >> > -- >> > DCRails.com || Making the Metrorail fun! >> > _______________________________________________ >> > Rails-spinoffs mailing list >> > Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> > http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> _______________________________________________ >> Rails-spinoffs mailing list >> Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org >> http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs >> > >_______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
It is a performance hit. Dot notation is a performance hit and you should avoid it in loops and volatile functions (things that are run very often). However, you should scrutinize the usage of it since it will not help you all that much everywhere. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 3:41 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties Would it be better if I cached the object? eg: var E = Many.util.Error; E.test(); E.test2(); E.test3(); Instead of Mandy.util.Error.test(); Mandy.util.Error.test1(); Mandy.util.Error.test2(); Thanks, Mandy. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 12:59 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Minimizing dots for accessing properties This is more of a javascript question. I would like to know if there is a performance hit if variable/properties are accessed with many dots? Eg: Calling a method test() like Mandy.util.Error.test(); Vs Error.test(); Thanks in advance, Mandy. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
I botched that last email. Dot performance can be an issue in for loops and functions that are repeatedly. The more dots you add the worse. Caching values is a great way to avoid the performance hit because even though a dot notation identifier might appear more than once in a block of code it is evaluated each time it is crossed. I personally do not cache all over the place. However when I am writing initialization code, loop code, or functions that are called heavily, I make sure to avoid deep dots. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Martinez, Andrew Sent: Tuesday, May 23, 2006 9:02 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties It is a performance hit. Dot notation is a performance hit and you should avoid it in loops and volatile functions (things that are run very often). However, you should scrutinize the usage of it since it will not help you all that much everywhere. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 3:41 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties Would it be better if I cached the object? eg: var E = Many.util.Error; E.test(); E.test2(); E.test3(); Instead of Mandy.util.Error.test(); Mandy.util.Error.test1(); Mandy.util.Error.test2(); Thanks, Mandy. -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org]On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 12:59 PM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: [Rails-spinoffs] Minimizing dots for accessing properties This is more of a javascript question. I would like to know if there is a performance hit if variable/properties are accessed with many dots? Eg: Calling a method test() like Mandy.util.Error.test(); Vs Error.test(); Thanks in advance, Mandy. _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
So, you are advocating to use - var E = Many.util.Error; E.test(); E.test2(); E.test3(); this?
Yes, in most cases it is worth the use, especially in heavily used code blocks. -Andrew Martinez -----Original Message----- From: rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org [mailto:rails-spinoffs-bounces-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org] On Behalf Of Maninder, Singh Sent: Tuesday, May 23, 2006 9:09 AM To: rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org Subject: RE: [Rails-spinoffs] Minimizing dots for accessing properties So, you are advocating to use - var E = Many.util.Error; E.test(); E.test2(); E.test3(); this? _______________________________________________ Rails-spinoffs mailing list Rails-spinoffs-1W37MKcQCpIf0INCOvqR/iCwEArCW2h5@public.gmane.org http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs
Martinez, Andrew wrote:> You need to use beforeStartInternal not beforeStart. > > Here is an example: > > >Thanks for showing me the example. I''ve tried it (& poked around in effects.js -- to find the useful inspect() function), so I came up with the following code: vis = $(this.headers[i]+''Text'').visible(); if (vis) { new Effect.BlindUp( this.headers[i]+''Text'', { queue: {scope: ''headers''}, beforeStartInternal: function(effect) { $(''debug'').innerHTML = effect.inspect(); } }); } In my <div id="debug">, the following prints --> "#,options:#" leading me to believe that effect is not a pointer to the actual BlindUp effect being called (as it should be at least populated with defaultOptions? Any ideas? ~ brice