制作一个GWT应用多页面 [英] Making a GWT app multipage

查看:112
本文介绍了制作一个GWT应用多页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

通过多页我的意思是单独的HTML文件,例如index.html,admin.html等。

现在有一个解决方案可以实现这个功能,即在EntryPoint类中:

  if(!Window.Location.getPath()。toLowerCase()。endsWith(myhtmlpage.html){
return;
}

这里我想深入理解的是我的GWT应用程序有主应用程序,管理应用程序等。应用程序nocache.js文件的趋势将变得更大,因此加载时间更长。



问题将会是,上面的代码是否阻止编译后的GWT应用程序的其他部分加载应用程序的不必要的部分,比如说Index EntryPoint或Admin EntryPoint的代码是单独加载的?

解决方案

正确的Patrick,



另外,没有办法使用js库的代码分割方法项目(而不是GWT),所以分割页面是正确的,以避免你使用的JS库r你的管理员代码,但你没有在你的前台使用,没关系,如果你在页面中包含js,而你没有通过GWT注入它。否则,你有责任分割代码(有一个可用于所有人的公共包,但每个'页'有单独的负载)。

理论上,他们说,好分裂点是一项活动(但我不确信,因为我的网页中有很多活动,单独加载每个脚本可能会对性能造成影响,所以这是针对每个案例的分析),您可以看到所有内容拆分为编译器报告



花点时间看这个视频,它会为您节省很多麻烦
https://www.youtube.com/watch?v=0F5zc1UAt2Y


By multipage I mean separate HTML files, say index.html, admin.html etc.

Now one solution to achieve this is to have this in the EntryPoint class:

 if (!Window.Location.getPath().toLowerCase().endsWith("myhtmlpage.html") {
   return;
 }

The thing I want to understand deeply here is what is my GWT app have the main app, admin app, etc. The tendency of the app nocache.js file will get bigger, thus longer to load.

The question would be, does the code above prevent other parts of the compiled GWT app to load unnecessary parts of the app, say athe code for the Index EntryPoint or the Admin EntryPoint are loaded separately?

解决方案

Right Patrick,

In addition, there is no way to use the code splitting method for js libraries that are not in your project (not GWT). So splitting pages is right to avoid js libraries you use for your admin code but you don't use in your front office, that's ok if you include the js in the page and you don't inject it through GWT. Otherwise it's your responsibility to split the code (have a common package that is available to all, but individual loads per 'page')

In theory, they say, the good split point is an activity (but I'm not convinced, since I have many activities in my pages, and loading each script alone could be bad for performance, so it's a per case analysis), you can see all what is included in your split in the compiler report

Take the time to look this video, it will save you a lot of troubles https://www.youtube.com/watch?v=0F5zc1UAt2Y

这篇关于制作一个GWT应用多页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆