Files
iD/js/iD/Controller.js
T
Tom MacWright 3bb7b589f1 No more new
2012-10-24 15:33:46 -04:00

20 lines
542 B
JavaScript
Executable File

if (typeof iD === 'undefined') iD = {};
iD.Controller = function() {
var controller = {},
state = null;
controller.undoStack = new iD.UndoStack();
controller.setState = function(newState) {
// summary: Enter a new ControllerState, firing exitState on the old one, and enterState on the new one.
if (newState === state) { return; }
if (state) state.exitState();
newState.controller = controller;
state = newState;
newState.enterState();
};
return controller;
};