AnsweredAssumed Answered

BUG in esri.UndoManager class

Question asked by dgarcrom on Mar 13, 2012
Latest reply on Mar 13, 2012 by Jian
I have foung a big error in esri.UndoManager class of 2.x version. It has a array property "_historyStack" declare in the class directly. It should be declared in the constructor. It´s cause that all instance of this class share the same array. For example, if you create 2 navigation toolbar, all toolbar have the same extents history. You can fix this error init this array after create the object...

var toolbar = new esri.toolbars.Navigation(map);
toolbar._undoManager._historyStack = [];


Please visit this...

http://livedocs.dojotoolkit.org/dojo/declare

"If your class contains arrays or other objects, they should be declared in the constructor so that each instance gets its own copy. Simple types (strings, numbers, booleans, null) are fine to declare in the class directly because simple types are assigned by value, whereas objects are assigned by reference (in JS, arrays are also considered objects)."

Outcomes