define([ 'dojo/_base/declare', 'dijit/registry' ],function(declare,registry){ var Content = declare(null,{ _started: false, _container: null, _previousContent: null, _dirty: false, startup: function() { if ( this._started ) { return; } this._container = registry.byId('content'); if ( !this._container || !this._container.addChild ) { throw new Error("Cannot find container widget with id 'content'."); } this._toaster = registry.byId('toaster'); if ( !this._toaster || !this._toaster.setContent ) { throw new Error("Cannot find toaster widget with id 'toaster'."); } this._started = true; }, set: function(widget) { if ( !this._started ) { throw new Error('Call startup() before setting content.'); } if ( this._previousContent ) { this._previousContent.destroyRecursive(); this._previousContent = null; } widget.region = 'center'; this._previousContent = widget; this._container.addChild(widget); }, notify: function(text,type) { if ( !this._started ) { throw new Error('Call startup() before setting content.'); } this._toaster.setContent(text,type || 'message'); }, markDirty: function() { this._dirty = true; }, markClean:function() { this._dirty = false; }, isDirty: function() { return this._dirty; } }); return new Content(); });