When running code in the context of a "thread" in the Google Gears API you do not have access to the "document" object and therefore createElement cannot be used to dynamically load a script.
Does anyone have any ideas about how I might go about "injecting" code in such a scenario? The only method I can think of is using a webservice and a JSON object which I would then eval but this creates its own series of problems and complexities and leaves a bad taste in my mouth.
The problem is I am ending up with large monolithic bits of code and various duplication of code due to this limitation and there is nothing that I hate more.
Any ideas?