简体   繁体   English

GWT插件如何工作?

[英]How does GWT Plugin work?

It is documented that GWT converts java code ( a few extensions not supported ) to javascript which gets rendered. 据记载,GWT将Java代码(不支持某些扩展名)转换为可呈现的javascript。 When does this conversion happen? 这种转换何时发生? I want to know the steps and the agents involved at each step. 我想知道步骤以及每个步骤涉及的代理。 Why do we need GWT plugins for each browser? 为什么每个浏览器都需要GWT插件? What part of the conversion is handled by the library and what part is handled by the plugin? 转换的哪一部分由库处理,哪一部分由插件处理?

I have read a lot of tutorials but this point is still vague. 我已经阅读了很多教程,但是这一点仍然很模糊。

It is important to understand about GWT that there's a big difference between production mode and development mode. 重要的是要了解GWT,生产模式和开发模式之间存在很大差异。 You write Java code and for deployment, the GWT compiler compiles it to JavaScript which is then interpreted by the browser. 您编写Java代码并进行部署,GWT编译器编译为JavaScript,然后由浏览器解释 So, in production, the conversion happens only one time, before you deploy your web app to a server. 因此,在生产中,仅将一次转换发生,然后再将Web应用程序部署到服务器。 And in this case, no browser plugin is needed because modern browsers can interpret JavaScript without any help. 在这种情况下,不需要浏览器插件,因为现代浏览器无需任何帮助即可解释JavaScript。

In development mode however, things are different. 但是,在开发模式下,情况有所不同。 The Java code is interpreted by the GWT browser plugin directly, without an explicit compilation from Java into JavaScript. GWT浏览器插件直接解释 Java代码,而无需从Java显式编译成JavaScript。 So you only need a browser plugin in development mode. 因此,您只需要在开发模式下使用浏览器插件即可。

And then there's super dev mode, which is different from the scenarios above. 然后是超级开发模式,与上面的场景不同。 This page explains it all. 本页说明了所有内容。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM