簡體   English   中英

GWT元素是否使用JsType或JSNI疊加層?

[英]Does GWT elemental use JsType or JSNI Overlays?

我正在研究GWT基本元素,作為在GWT中訪問Java dom的更快方法。 但是,當我查看Maven依賴項的源代碼時,只看到js覆蓋圖。 例如:

public class JsNode extends JsElementalMixinBase  implements Node {
  protected JsNode() {}

  public final native JsNamedNodeMap getAttributes() /*-{
    return this.attributes;
  }-*/;

  public final native String getBaseURI() /*-{
    return this.baseURI;
  }-*/;

  public final native JsNodeList getChildNodes() /*-{
    return this.childNodes;
  }-*/;

  public final native JsNode getFirstChild() /*-{
    return this.firstChild;
  }-*/;

  public final native JsNode getLastChild() /*-{
    return this.lastChild;
  }-*/;
....

這與默認gwt xml dom中的內容相差不遠。 我在這里想念什么?

謝謝!

不再定期更新的Elemental v1使用JSO和JSNI,因為這是當時的唯一選擇。

Elemental v2使用JsInterop,這是一種新的,面向未來的方法,可以從Java代碼中描述JS對象。 來源(和問題跟蹤)位於https://github.com/google/elemental2/ 您可以通過搜索groupId com.google.elemental2在maven中找到elemental2: http : //search.maven.org/#search%7Cga%7C1%7Cg%3A%22com.google.elemental2%22

https://github.com/google/jsinterop-generator是用於自動生成elemental2的工具,理論上可以在任何其他JS庫上使用,以使GWT應用程序可以使用它。 我個人並沒有運氣,但是該工具的主要目的仍然是生成elemental2源,因此隨着人們的使用,這種情況將繼續得到改善。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM