[Proto-Scripty] Re: how to load scripts dinamically
Excellent, thanks Rob. That's how I *thought* it worked, but I wanted to check the spec to be sure. Thanks for the reference! -- T.J. :-) On Oct 17, 4:48 am, RobG <[EMAIL PROTECTED]> wrote: > On Oct 17, 3:22 am, SWilk <[EMAIL PROTECTED]> wrote: > > > > > Hey, > > > T.J. wrote a How-To on the wiki based on todays thread: > > >http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami... > > > I just have one question regarding the how-to: > > > > > Here's the dynamic.js file: > > > scriptLoaded('dynamic'); > > function coolFeature() > > { > > alert('Coolness!');} > > > > > > Is it possible that the execution of this included script was paused > > after scriptLoaded() call, but before coolFeauture() is created? > > The ECMAScript Spec, section 14 Program says: > > | The production Program : SourceElements is evaluated as follows: > | 1. Process SourceElements for function declarations. > | 2. Evaluate SourceElements. > | 3. Return Result(2). > > In other words, all the script is read, then execution begins. You > may have issues if the function is defined in a script that is loaded > after a script that calls it. > > -- > Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: how to load scripts dinamically
On Oct 17, 3:22 am, SWilk <[EMAIL PROTECTED]> wrote: > Hey, > > T.J. wrote a How-To on the wiki based on todays thread: > > http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami... > > I just have one question regarding the how-to: > > > Here's the dynamic.js file: > > scriptLoaded('dynamic'); > function coolFeature() > { > alert('Coolness!');} > > > > Is it possible that the execution of this included script was paused > after scriptLoaded() call, but before coolFeauture() is created? The ECMAScript Spec, section 14 Program says: | The production Program : SourceElements is evaluated as follows: | 1. Process SourceElements for function declarations. | 2. Evaluate SourceElements. | 3. Return Result(2). In other words, all the script is read, then execution begins. You may have issues if the function is defined in a script that is loaded after a script that calls it. -- Rob --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: how to load scripts dinamically
look at ensure.js On 16 окт, 20:22, SWilk <[EMAIL PROTECTED]> wrote: > Hey, > > T.J. wrote a How-To on the wiki based on todays thread: > > http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami... > > I just have one question regarding the how-to: > > > Here's the dynamic.js file: > > scriptLoaded('dynamic'); > function coolFeature() > { > alert('Coolness!');} > > > > Is it possible that the execution of this included script was paused > after scriptLoaded() call, but before coolFeauture() is created? > If so, it would be possible that the script already announced itself, > but is not ready yet. Then I think the callback should be called after > all the functions was created, on the bottom of the script. > > I do not know the javascript on such basic level so I might be wrong. > > -- > Regards, > SWilk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---
[Proto-Scripty] Re: how to load scripts dinamically
> If so, it would be possible that the script already announced itself, > but is not ready yet. Then I think the callback should be called after > all the functions was created, on the bottom of the script. I don't *think* so, I'll have a look at the spec out of curiosity. In the meantime, though, there's no reason we can't put the call at the end instead of at the beginning -- it's not going to cause any harm... I've updated the page. Thanks, -- T.J. Crowder tj / crowder software / com On Oct 16, 6:22 pm, SWilk <[EMAIL PROTECTED]> wrote: > Hey, > > T.J. wrote a How-To on the wiki based on todays thread: > > http://proto-scripty.wikidot.com/prototype:how-to-load-scripts-dynami... > > I just have one question regarding the how-to: > > > Here's the dynamic.js file: > > scriptLoaded('dynamic'); > function coolFeature() > { > alert('Coolness!');} > > > > Is it possible that the execution of this included script was paused > after scriptLoaded() call, but before coolFeauture() is created? > If so, it would be possible that the script already announced itself, > but is not ready yet. Then I think the callback should be called after > all the functions was created, on the bottom of the script. > > I do not know the javascript on such basic level so I might be wrong. > > -- > Regards, > SWilk --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group. To post to this group, send email to prototype-scriptaculous@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en -~--~~~~--~~--~--~---