Difference between GWT.create(SomeClass.class) and new SomeClass()

来源:互联网 发布:迈阿密热线 知乎 编辑:程序博客网 时间:2024/06/05 19:47

GWT.create is used by the GWT compiler for deferred binding. Deferred binding is a feature of the GWT compiler that works by generating many versions of code at compile time, only one of which needs to be loaded by a particular client during bootstrapping at runtime. if the implementation doesn't change for different locale/browsers, use new, if there will be multiple implementations use create.



Coding Basics - Deferred Binding

Deferred binding is a feature of the GWT compiler that works by generating many versions of code at compile time, only one of which needs to be loaded by a particular clientduring bootstrapping at runtime. Each version is generated on a per browser basis, along with any other axis that your application defines or uses. For example, if you were tointernationalize your application usingGWT's Internationalization module, the GWT compiler would generatevarious versions of your application per browser environment, such as "Firefox in English", "Firefox in French", "Internet Explorer in English", etc... As a result, the deployedJavaScript code is compact and quicker to download than hand coded JavaScript, containing only the code and resources it needs for a particular browser environment.



原创粉丝点击