AnsweredAssumed Answered

esri/views/SceneView module breaks Object.assign()

Question asked by mvrticharcdata-cz-esridist Employee on Jul 23, 2015
Latest reply on Jul 24, 2015 by YCabon-esristaff

There is Object.assign() polyfill coming with esri/views/SceneView module (inside the esri/views/3d/canvas3d/webgl-engine/lib/es6-shim submodule).

This polyfill seems to be wrong.

According the https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/assign, the Object.assign() should be able to process multiple sources, which the Object.assign() polyfill coming with esri/views/SceneView does not support.

 

Example:

Object.assign({}, {a:1}, {b:2}); // should return {a:1, b:2}, the polyfill returns {a:1}.

 

You can try the example alive:

1. Open http://developers.arcgis.com/javascript/beta/sample-code/source-code/3d/basic3d/index.html in Chrome (Chrome does not implement the Object.assign() yet, so the polyfill will be used)

2. Run Object.assign({}, {a:1}, {b:2}); in the console

3. The result is {a:1}

 

4. Open http://developers.arcgis.com/javascript/beta/sample-code/source-code/3d/basic3d/index.html in Firefox (Firefox already implements Object.assign() since v34)

5. Run Object.assign({}, {a:1}, {b:2}); in console

6. The result is {a:1, b:2}

 

Generally I do not think it is good idea to pollute global scope with polyfills coming with EsriJS library itself.

Outcomes