//>>built
define("dojox/mvc/StoreRefController",["dojo/_base/declare","dojo/_base/lang","dojo/when","./getStateful","./ModelRefController"],function(m,h,k,l,n){return m("dojox.mvc.StoreRefController",n,{store:null,getStatefulOptions:null,_refSourceModelProp:"model",queryStore:function(b,c){if((this.store||{}).query){this._queryObserveHandle&&this._queryObserveHandle.cancel();var d=this,a=this.store.query(b,c),e=k(a,function(g){if(!d._beingDestroyed)return g=l(g,d.getStatefulOptions),d.set(d._refSourceModelProp,
g),g});e.then&&(e=h.delegate(e));for(var f in a)isNaN(f)&&a.hasOwnProperty(f)&&h.isFunction(a[f])&&(e[f]=a[f]);return e}},getStore:function(b,c){if((this.store||{}).get){this._queryObserveHandle&&this._queryObserveHandle.cancel();var d=this;return result=k(this.store.get(b,c),function(a){if(!d._beingDestroyed)return a=l(a,d.getStatefulOptions),d.set(d._refSourceModelProp,a),a})}},putStore:function(b,c){if((this.store||{}).put)return this.store.put(b,c)},addStore:function(b,c){if((this.store||{}).add)return this.store.add(b,
c)},removeStore:function(b,c){if((this.store||{}).remove)return this.store.remove(b,c)}})});