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

2960
1
Jump to solution
07-23-2015 04:39 AM
MatejVrtich
Esri Contributor

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.

Tags (1)
0 Kudos
1 Solution

Accepted Solutions
YannCabon
Esri Contributor

Hi Matej,

we will work on this for beta2.

View solution in original post

1 Reply
YannCabon
Esri Contributor

Hi Matej,

we will work on this for beta2.