dragome / dragome-sdk

Dragome is a tool for creating client side web applications in pure Java (JVM) language.
http://www.dragome.com
Other
80 stars 20 forks source link

Web Worker Support #84

Open ghost opened 8 years ago

ghost commented 8 years ago

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

ghost commented 8 years ago

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.

ghost commented 8 years ago

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.

fpetrola commented 8 years ago

@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.

ghost commented 8 years ago

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;