On Wednesday, April 12, 2017 at 9:01:37 AM UTC+2, DavidN wrote:
There is one thing people keep on repeating:You can only invoke the exported class/method when the gwt app is loaded.
Just like with any asynchronously loading script.
For example, the Google Analytics snippet sets up window.ga() so you can call it before the script is loaded, queuing the calls, and when the script loads it'll (probably) replace window.ga() with its own and processing the queued calls.
Shadow AMP works the same (though even simpler): https://www.ampproject.org/fr/docs/guides/pwa-amp/amp-in-pwa
Is there a GWT supported default way that would allow this ?Otherwise I guess you would need to add a callback mechanism in the EntryPoint (Using JsInterop)
You cannot do the same as GA or Shadow AMP by simply exporting some class, but this can (probably) be done using a native JsType to read and re-define the global variable from your onModuleLoad.
Or you could simply check whether a global variable/function with a specific name is defined and then call it from your onModuleLoad (contrary to an approach like Shadow AMP, only one such callback could be defined then).
You received this message because you are subscribed to the Google Groups "GWT Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at https://groups.google.com/group/google-web-toolkit.
For more options, visit https://groups.google.com/d/optout.
No comments:
Post a Comment