Manually merge application

This commit is contained in:
Ritchie 2013-07-17 14:30:38 -07:00
parent 7c7667151a
commit f7791fc366
1 changed files with 14 additions and 63 deletions

View File

@ -25,21 +25,6 @@ app.remotes = function () {
} }
} }
/**
* Expose an object or Class remotely.
*
* @param {String} name The remote namespace (eg. url base)
* @param {Object|Function} obj The object to remote
*/
app.remote = function (name, obj) {
// add the object to the remote exports
this.remotes().exports[name] = obj;
// clear the handlers cache
this._handlers = {};
}
/** /**
* Remove a route by reference. * Remove a route by reference.
*/ */
@ -59,7 +44,6 @@ app.disuse = function (route) {
*/ */
app._models = []; app._models = [];
app._services = [];
/** /**
* Expose a model. * Expose a model.
@ -68,8 +52,6 @@ app._services = [];
*/ */
app.model = function (Model) { app.model = function (Model) {
var remotes = this.remotes();
this._models.push(Model); this._models.push(Model);
Model.shared = true; Model.shared = true;
Model.app = this; Model.app = this;
@ -85,28 +67,22 @@ app.models = function () {
} }
/** /**
* Expose a service. * Get all remote objects.
*
* @param {String} name
* @param {Service} service
*/ */
app.service = function (name, service) { app.remoteObjects = function () {
this._services.push(service); var result = {};
service.shared = true; var models = this.models();
service.app = this; // add in models
models.forEach(function (ModelCtor) {
// add to the remote exports // only add shared models
this.remote(name, service); if(ModelCtor.shared && typeof ModelCtor.sharedCtor === 'function') {
} result[ModelCtor.pluralModelName] = ModelCtor;
}
/** });
* Get all exposed services.
*/ return result;
app.services = function () {
return this._services;
} }
/** /**
@ -115,29 +91,4 @@ app.services = function () {
app.remotes = function () { app.remotes = function () {
return this._remotes || (this._remotes = RemoteObjects.create()); return this._remotes || (this._remotes = RemoteObjects.create());
} }
/**
* Get a remotes handler.
*/
app.handler = function (type) {
var handler = this._handlers[type];
if(!handler) {
// get the sl remoting object
var remotes = this.remotes();
// create and save the handler
handler = this._handlers[type] = remotes.handler(type);
}
return handler;
}
/*!
* Handlers
*/
app._handlers = {};