Google Developers2.39 млн
Опубликовано 10 июня 2008, 23:05
Surprisingly Rockin' JavaScript and DOM Programming in GWT
Bruce Johnson (Google)
You may already know about GWT's nifty JavaScript Native Interface (JSNI), which allows you to define native Java methods with handwritten JavaScript. In GWT 1.5, there's an even more powerful way to program close to the metal. You can now model arbitrary JavaScript types directly as Java classes (specifically, as subclasses of GWT's JavaScriptObject class), yet there is no overhead in size or speed. You can code against any JavaScript object as if it were a regular old Java object. So, what does that buy you?
* It's never been easier to integrate with external JS libraries; just define a Java class that models the JS object you want to interact with. Nice Java syntax, no overhead.
* Freely use low-level native JS data structures (JS arrays, for example) by exposing them with a Java-friendly API. You can even apply Java generics to JS types!
* Superimpose strongly-typed Java classes on JSON objects, giving you IDE code completion, refactoring and compile-time type checking.
* GWT uses this new ability to provide a complete cross-browser DOM class hierarchy based on the W3C's Java HTML bindings. Programming straight to the DOM has never been more productive.
Come learn about this unusual and powerful new capability that you can use to squeeze every drop of performance and interop out of your GWT projects.
Bruce Johnson (Google)
You may already know about GWT's nifty JavaScript Native Interface (JSNI), which allows you to define native Java methods with handwritten JavaScript. In GWT 1.5, there's an even more powerful way to program close to the metal. You can now model arbitrary JavaScript types directly as Java classes (specifically, as subclasses of GWT's JavaScriptObject class), yet there is no overhead in size or speed. You can code against any JavaScript object as if it were a regular old Java object. So, what does that buy you?
* It's never been easier to integrate with external JS libraries; just define a Java class that models the JS object you want to interact with. Nice Java syntax, no overhead.
* Freely use low-level native JS data structures (JS arrays, for example) by exposing them with a Java-friendly API. You can even apply Java generics to JS types!
* Superimpose strongly-typed Java classes on JSON objects, giving you IDE code completion, refactoring and compile-time type checking.
* GWT uses this new ability to provide a complete cross-browser DOM class hierarchy based on the W3C's Java HTML bindings. Programming straight to the DOM has never been more productive.
Come learn about this unusual and powerful new capability that you can use to squeeze every drop of performance and interop out of your GWT projects.
Свежие видео