1
0
Fork 0
mirror of https://github.com/kbparagua/paloma synced 2023-03-27 23:21:17 -04:00

Rename files controller_builder to controller_factory

This commit is contained in:
kbparagua 2014-05-29 23:00:18 +08:00
parent 216511c5f6
commit 43d11ee081
3 changed files with 1 additions and 56 deletions

View file

@ -1,55 +0,0 @@
(function(Paloma){
var ControllerFactory = function(router){
this.instances = {};
this.router = router;
};
ControllerFactory.prototype.make = function(name){
var config = this.router.parse(name),
scope = this.instances;
// Create namespaces.
for (var i = 0, n = config['namespaces'].length; i < n; i++){
var namespace = config['namespaces'][i];
scope[namespace] = scope[namespace] || {};
scope = scope[namespace];
}
return scope[config['controller']] = createConstructor();
};
ControllerFactory.prototype.get = function(name){
var config = this.router.parse(name),
scope = this.instances;
for (var i = 0, n = config['controllerPath'].length; i < n; i++){
var path = config['controllerPath'][i];
if (scope[path] != null){ scope = scope[path]; }
else { return null; }
}
return scope;
};
var createConstructor = function(){
var constructor = function(params){ this.params = params; }
$.extend(constructor, Paloma.Controller);
$.extend(constructor.prototype, Paloma.Controller.prototype);
return constructor;
};
Paloma.ControllerFactory = ControllerFactory;
})(window.Paloma);

View file

@ -1,6 +1,6 @@
//= require ./init.js
//= require ./router.js
//= require ./controller.js
//= require ./controller_builder.js
//= require ./controller_factory.js
//= require ./engine.js
//= require ./paloma.js