Is there a way to "inject" a worker context into my thread, or some other workaround?
Ringo tries to find the Worker via the ThreadLocal *or* from the scope. So if you inject a function, which was created in a Ringo context, into a native Thread, that could help. That is why examples/swing.js works: a callback, defined in Ringo, is passed into swing. The callback carries the scope with it and setInterval works even though it is being exeucted in a native Thread with no RingoWorker attached.
I guess you have already seen the setInterval implementation, which you redefined:
https://github.com/ringo/ringojs/commit/1a753a8a6dbf3a9a61a53940971d342f93d7c3d6 Note how `getCurrentWorker()` has one argument: the callback! That's missing from your re-implementation, so the "get worker from scope" path is not running.
I don't get what your code is trying to show. The example works for me; with the normal setInterval and with your JS reimplementation. If nothing I said was helpful, you might want to post a more complete example and we could work something out...
Also, I assume you are doing all that to work around the promise.wait() problem? If that is your issue, you might want to take a look at when.js or another promise implementation until we fix ours.
simon
simon