Quantcast
Channel: SCN : All Content - All Communities
Viewing all articles
Browse latest Browse all 8392

SDK extension with require.js and CDN

$
0
0

Hi,

 

I'm working with Design Studio and ESRI ArcGIS for the first time, implementing a quick sample based on this tutorial:

 

Build your first application | Guide | ArcGIS API for JavaScript

 

The code looks like this:

 

  var map;  require(["esri/map", "dojo/domReady!"], function(Map) {     map = new Map("mapDiv", {      center: [-56.049, 38.485],      zoom: 3,      basemap: "streets"    });  });

I was able to implement it in Design Studio like this:

 

sap.zen.Dispatcher.instance.require(["esri/map", "dojo/domReady!"], function(Map) {  sap.designstudio.sdk.Component.subclass("com.sap.sample.esri.Esri", function() {  var that = this;  "use strict";  var map;  this.init = function() {  var mapDiv = $('<div/>', {id: 'mapDiv', class:'map'});  this.$().append(mapDiv[0]);  };  this.afterUpdate = function() {         map = new Map("mapDiv", {           basemap: "topo",           center: [-122.45, 37.75], // longitude, latitude           zoom: 13         });  };  });
});

However, this requires me to add the entire 40MB ESRI/Dojo API to my project, something I would not want to do for a productive use case. My question is, is it possible to leverage CDN for hosting external API? It would be great if there was something like sap.zen.Dispatcher.instance.require.config available to provide different paths or baseURL:


RequireJS API


Any thoughts on this? I started going down the route of using my own version of require.js, in the way Mike explained in this SCN thread:


Is it possible to include d3 v3 into Design Studio SDK Component?


However, I stopped when I read Reiner's reply and his supplemental document here:


What's Coming in Design Studio 1.4 SDK


What's the right approach for working with a CDN? I appreciate any advice.


Thanks,

Jim


Viewing all articles
Browse latest Browse all 8392


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>