Hot answers tagged

3

require(["dojo/_base/lang"], function(lang){ var myObj = { //A simple object with the property of foo foo: "bar" }; var func = lang.hitch(myObj, function(){ //Using lang.hitch we can point to the scope that we want. Now "this" is pointing to myObj console.log(this.foo);//Grabbing the contents of ...


2

Robert Scheitlin answered a similar question on https://community.esri.com/t5/arcgis-web-appbuilder-questions/lang-hitch-what-does-it-do/m-p/436487 lang.hitch enables you to keep a code block in scope. Say you have a function that has a inline function and you want to call this.map to get a refernec to the map object well if you are calling this.map from ...


1

you can define dojo packages in main.js, so index.html looks like this : <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <meta name="viewport" content="initial-scale=1, maximum-scale=1, user-scalable=no"> <title>ArcGIS API for JavaScript Hello World App</title> <style> ...


Only top voted, non community-wiki answers of a minimum length are eligible