I have a couple of great webSDK controls working now. The one in question here has a problem with timing, sometimes the loadLibraries command doesnt get the library served up fast enough and when I go to send a message to one of the controls I just get an error because the library isnt there yet. The second attempt to load the page on any session always worked fine.
Attempting to fix that I decided that I would return the library from the setupJavascriptFramework event. This is shown in the YUI text editor example and I used it with a mobile safari webSDK control without a problem so I very simply changed from calling the loadLibrary command with a webFile reference to just returning the text. That should work, and it does work 100% of the time on iOS. On the browser however I get the error:
Could not execute returned javascript: undefined is not an object (evaluating 'XojoCustom.XTension.motion24)
and then the rest of my source code and a whole lot of xojo javascript.
This same code when loaded through the loadLibrary command works fine, just not on the first hit of the page. There are a LOT more xojo javascript in that error message after my source and sure enough 415 lines down the script that caused the error I found:
Xojo.createNamespace(“XTension.motion24”);
So the thing that was undefined was my javascript namespace. It hadnt been created yet. On iOS this never happens, on the browser in this app it always happens. But it never happens when I work with the YUI text editor example, perhaps it has to do with how many controls are in the window as I have lots of them in this example.
It seems that my namespace should be guaranteed to have been created before you ask me for code to add to it? Is this a bug or do I not understand completely how this is supposed to be used, which is entirely possible, but Im not doing anything that the YUI text editor example doesnt do.