dragome/dragome-sdk

Web Worker Support

Opened this issue · 4 comments

Dragome produced code should also be able to work in a web worker.

https://github.com/bertung/dragome-sdk/blob/resources/dragome-web/src/main/java/com/dragome/web/enhancers/jsdelegate/DefaultDelegateStrategy.java

@MethodAlias(alias= "window.getSimpleClassname")

may be replaced with

@MethodAlias(alias= "self.getSimpleClassname")
to make it compatible with web workers. Web workers do not have window object.

It looks like it is not possible to make Dragome web worker friendly with the use of qxoo library. It has window references all over. I am closing this bug because it looks impracticable to change it.

@MethodAlias(alias= "window.getSimpleClassname") is the only usage of MethodAlias that is referencing the Window object, all the other usages are either local aliases or EventDispatcher references. I believe it's really easy to decouple from Window object at least for MethodAlias usages.

It just occured to me. Add the following line of code to the helpers.js, it should solve it all

if(window===undefined)self.window=self;