ArcGIS API for JavaScript 需要在DoJo中加载的资源

The amount of Dojo you use when you work with the ArcGIS API for JavaScript is up to you, but at a minimum you'll need to use several common functions:

  •  dojo.require: Similar to the <script> include tag on an HTML page. It imports resources into your JavaScript page.
    // AMD
    require(["esri/map", ... ], function(Map, ... ){ ... });

    // legacy
    dojo
    .require("esri.map");

    For the JavaScript API, the most commonly imported resources are:

    Resource Use for:
    esri.map Map, geometry, graphics, and symbols
    esri.layers.agsdynamic ArcGISDynamicMapServiceLayer
    esri.layers.agstiled ArcGISTiledMapServiceLayer
    esri.tasks.find Find task
    esri.tasks.geometry Geometry task
    esri.tasks.gp Geoprocessing task
    esri.tasks.identify Identify task
    esri.tasks.locator Locator task
    esri.tasks.query Query task
    esri.toolbars.draw Draw
    esri.toolbars.navigation Navigation
  •  dojo.ready (or dojo.addOnLoad): Similar to <body οnlοad="">. It registers an initializing block after the page has finished loading.
    // legacy
    dojo
    .ready(init);

    // AMD
    require(["dojo/ready"], function(ready){
      ready
    (function(){
       
    // This function won't run until the DOM has loaded and other modules that register have run.
     
    });
    });
  •  dojo.connect: Similar to Element.addEventListener and Element.attachEvent JavaScript functions. It registers a listener to listen to specific events on an Object or element on the page and returns results from a function.
    // legacy
    dojo
    .connect(myMap, "onLoad", myLoadHandler);

    // AMD
    require(["esri/map", "dojo/on"], function(Map, on) {
     
    // ...
      on
    (myMap, "load", callback);
    });
  •  dojo.byId: Similar to the document.getElementById(id) JavaScript function. The function searches and returns the first HTML element with the argument ID.
    dojo.byId("myInputField").value = myMap.id; 
  •  dojo array extras: refer to the Arrays Made Easy tutorial on dojotoolkit.org

When writing your ArcGIS JavaScript applications, you can take advantage of the full Dojo toolkit, which includes buttons, grids, tree views, charts, and other widgets. The toolkit is divided into three parts:

Core - Essential functions like those listed above
Dijit - Themeable widgets such as trees, menus, and buttons
DojoX- Extension projects in various stages of development, such as graphics, grids, and charts

As stated previously, you can start building ArcGIS API for JavaScripts apps with minimal dojo knowledge. But, the more dojo you know, the more you'll be able to accomplish. Dojotoolkit.org's tutorials and documentation are a fantastic place to start.

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值