On 4/14/06, Will Merrell <[EMAIL PROTECTED]> wrote:
> The one problem with
> this is that any code that defines functions works only while being
> evaluated. The functions are not defined if you try to call them later.
They are defined in the context the eval is executed in. That is: as
inner functions of the evalScripts method.
If you want them to be members of the global object,
1. assign them to the global object using the window.newfunction =
function(){...} syntax
or
2. roll your own evalScripts method that does the eval in a
setTimeout, as timeouts are executed in the global object.
The drawback of number 2 is that the new functions are not available
directly after the evalScripts call. It depends on the intended use if
this is s problem or not. But that is just as with your method of
adding script elements to the DOM.
Bye,
Martin
_______________________________________________
Rails-spinoffs mailing list
[email protected]
http://lists.rubyonrails.org/mailman/listinfo/rails-spinoffs