var l = new GraphicsLayer(null)
TypeError {stack: "TypeError: Cannot read property 'plugins' of undef???esolve (http://js.arcgis.com/3.9/init.js:197:441)", message: "Cannot read property 'plugins' of undefined"} "TypeError: Cannot read property 'plugins' of undefined at http://js.arcgis.com/3.9/init.js:1005:336 at Object.some (http://js.arcgis.com/3.9/init.js:224:133) at g._pluginsHandler (http://js.arcgis.com/3.9/init.js:1005:305) at h.(anonymous function).g (http://js.arcgis.com/3.9/init.js:239:390) at new <anonymous> (http://js.arcgis.com/3.9/init.js:105:288)
// No optional params example var graphicsLayer1 = new GraphicsLayer(); // Optional param example; opacity var graphicsLayer2 = new GraphicsLayer({opacity:0.20});
Is there any particular reason you were passing null to GraphicsLayer?
Otherwise, like you said, just don't pass null and follow the documentation.
define(["dojo/_base/declare", "esri/layers/GraphicsLayer"], function (declare, esriGL) { return declare(esriGL, { constructor: function (options, graphics, symbol) { // graphics & symbol arguments optional // if present, do something interesting with them } }); });
require(["my/GL"], function (myGL) { var gl = new myGL({id: "someId"}, null, null); });
define(["dojo/_base/declare", "esri/layers/GraphicsLayer"], function (declare, esriGL) { return declare(esriGL, { preamble: function (options, graphics, symbol) { return [options]; }, constructor: function (options, graphics, symbol) { // graphics & symbol arguments optional // if present, do something interesting with them } }); });
Hi Tom,
Do you find something to solve your problem ?
With Arcgis 4.x when I try to inherit of GraphicsLayer I receive :
Uncaught TypeError: Cannot read property 'properties' of undefined
Jérôme.
That's way back Jérôme but I did dig up some old code (see attached). I don't think this is in use in any of our applications anymore so I'm not sure of its viability.
Also, since v4 was a complete rewrite from v3 I'm not sure how applicable it is to your problem - but here it is anyway, hope it helps.
Tom
Thanks Tom,
Finally, I rewrite my code in TypeScript.
The inheritance is easier to implement.
Best Regard,
Jérôme.