quarks
quarks

Reputation: 35282

How to "lazy" load widget to make GWT load faster

I have a gwt app that requires GWT Recaptcha for one of its part. However I don't need it for some parts of my application, and especially on the home "page". Is there a way for it not to load ahead unless the "page" that requires it is the one being opened?

And by "page" I mean a view (as in MVC), in my case I useRecaptchaWidget which is essentially the widget that calls on the RPC for api.recaptcha.net which I can see in the browser when I refresh my application. Clearly its causing some delay in the loading process of views that does not need it.

Is there any way to "lazy" load a widget such that only when the view that instantiates it is called that the widget will be called or even call RPC. Any ideas?

Upvotes: 0

Views: 1329

Answers (2)

Thomas Broyer
Thomas Broyer

Reputation: 64541

If your issue is that the widget makes an RPC call as soon as you instantiate it, then, well, don't instantiate it until you need it.

Upvotes: 2

Henrique Miranda
Henrique Miranda

Reputation: 994

You should use the Code Splitting It will download part of your code when you need it. Also will improve the starting size of your application, as the user doesn't need to download the whole application at once.

Upvotes: 2

Related Questions