I'm looking at getting the dojo toolkit working in Jaxers callback state in a similar way to the JQuery example. I can make things work correctly if I reload dojo with every "oncallback" but i was looking to make it more efficient with the 'define once' approach.
What I'm finding is that when you load a file, the functions defined in that file are present for that current callback and the global environment is correct. Following callbacks we use the "if" statement to check if the object is present in the global state and if it is we don't reload the file. But it seems the global environment is not quite right as if inside one of the loaded functions we call to a global variable, it is never found.
Please see the example case.
clicking reload1 the first time will load the testFunc.js file and run the callback correctly. Clicking it again fails as we don't reload the file and the global state is not right.
restarting the server to clear out the page state..
clicking reload2, the first time and all following times work correctly.
the only difference in the functions is function 2 uses 'this' to internally reference while function 1 calls itself.