Mercurial > pub > ImplabJs
diff src/implab/data/DataContext.js @ 34:27e8e9e38e07 default tip
Слияние
author | nickolay |
---|---|
date | Wed, 05 Jun 2019 20:44:15 +0300 |
parents | 8af8e840dd49 1dc2fd263b90 |
children |
line wrap: on
line diff
--- a/src/implab/data/DataContext.js Wed Jun 05 17:44:17 2019 +0300 +++ /dev/null Thu Jan 01 00:00:00 1970 +0000 @@ -1,45 +0,0 @@ -define([ "dojo/_base/declare", "../safe" ], function(declare, safe) { - return declare( - null, - { - _params : null, - - _repositories : null, - - constructor : function(opts) { - this._params = opts || {}; - this._repositories = {}; - }, - - getRepository : function(name) { - safe.argumentNotEmptyString(name, "name"); - var repo = this._repositories[name]; - if (!repo) { - repo = this._params[name]; - if (!repo) - throw new Error("The repository '" + name + - "' isn't found"); - if (repo instanceof Function) - repo = new repo(); // factory method or constructor - if (repo.initialize) { - repo.initialize({ - dataContext : this - }); - } else if (repo.setDataContext) { - repo.setDataContext(this); - } - this._repositories[name] = repo; - } - - return repo; - }, - - dispose : function() { - for( var name in this._repositories) { - var r = this._repositories[name]; - if (r.dispose) - r.dispose(); - } - } - }); -}); \ No newline at end of file