Permalink
Browse files

Simplified initializeFacade usage

  • Loading branch information...
1 parent 128952a commit 5280c0a2c6eedbe812fed57aa3eaefb1b31bc097 @rgr-myrg committed May 9, 2011
Showing with 12 additions and 12 deletions.
  1. 0 build.sh
  2. +1 −1 build/devshop-full.js
  3. +5 −5 build/devshop-mvc.js
  4. +1 −1 examples/devshop-full.js
  5. +1 −1 examples/mvc.html
  6. +4 −4 src/mvc.js
View
0 build.sh 100644 → 100755
File mode changed.
View
2 build/devshop-full.js
@@ -7,4 +7,4 @@
{};this.facade={};this.registerProxy=function(c){c.facade=this.facade;a[c.NAME]||(a[c.NAME]=c);if(typeof c.onRegister==="function")c.onRegister()};this.retrieveProxy=function(c){return a[c]?a[c]:null};this.removeProxy=function(c){if(typeof a[c].onRemove==="function")try{a[c].onRemove()}catch(b){}a[c]=null}},b=new DevShop.Observable(function(){var a={};this.facade={};this.notification={};this.registerMediator=function(c){c.facade=this.facade;a[c.NAME]||(a[c.NAME]=c,this.addObserver(c))};this.retrieveMediator=
function(c){return a[c]?a[c]:null};this.removeMediator=function(c){if(typeof a[c].onRemove==="function")try{a[c].onRemove()}catch(b){}a[c]=null};this.notifyObservers=function(a){for(var b=this.observers.length,d=0;d<b;d++)try{for(var e=this.observers[d].listNotificationInterests(),g=!1,f=0;l=e.length,f<l;f++)if(e[f]==this.notification.name){g=!0;break}if(g)this.observers[d].notification=this.notification,this.observers[d].notify(a,this)}catch(i){}};this.sendNotification=function(a){this.notification=
a;this.notifyObservers("handleNotification")}}),e=new DevShop.Observer(function(){var a={},c=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(b,d){d.facade=this.facade;a[b]||(a[b]=d,c.push(b))};this.listNotificationInterests=function(){return c};this.handleNotification=function(){var b=this.notification;if(typeof a[b.name]==="object"&&typeof a[b.name].execute==="function")try{a[b.name].execute(b)}catch(c){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(a){d.registerProxy(a)};
-this.registerMediator=function(a){b.registerMediator(a)};this.registerCommand=function(a,b){e.registerCommand(a,b)};this.retrieveProxy=function(a){return d.retrieveProxy(a)};this.retrieveMediator=function(a){return b.retrieveMediator(a)};this.removeProxy=function(a){d.removeProxy(a)};this.removeMediator=function(a){b.removeMediator(a)};this.sendNotification=function(a,c,d){b.sendNotification({name:a,body:c,type:d})};this.initializeFacade=function(a){d.facade=a;b.facade=a;e.facade=a;a.registerMediator(e)}}})})();
+this.registerMediator=function(a){b.registerMediator(a)};this.registerCommand=function(a,b){e.registerCommand(a,b)};this.retrieveProxy=function(a){return d.retrieveProxy(a)};this.retrieveMediator=function(a){return b.retrieveMediator(a)};this.removeProxy=function(a){d.removeProxy(a)};this.removeMediator=function(a){b.removeMediator(a)};this.sendNotification=function(a,c,d){b.sendNotification({name:a,body:c,type:d})};this.initializeFacade=function(){d.facade=this;b.facade=this;e.facade=this;this.registerMediator(e)}}})})();
View
10 build/devshop-mvc.js
@@ -3,8 +3,8 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(){window.DevShop=typeof window.DevShop==="object"?window.DevShop:{};window.DevShop.Me=function(d){for(var c in d)d.hasOwnProperty(c)&&(window.DevShop[c]=d[c]);DevShop=devshop=window.DevShop}})();(function(){DevShop.Me({SingletonFactory:function(d){var c=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},e=c(d.implement),a=c(d.extend),c=c(d.instance),b;for(b in a)a.hasOwnProperty(b)&&(c[b]||(c[b]=a[b]));for(b in e)if(e.hasOwnProperty(b)&&!c[b])throw d.instance+" must implement '"+b+"' "+typeof e[b];if(typeof c.initialize==="function")try{c.initialize()}catch(h){}return c}})})();(function(){DevShop.Me({Observable:function(d){return DevShop.SingletonFactory({extend:function(){this.observers=[];this.addObserver=function(c){if((typeof c==="function"||typeof c==="object")&&typeof c.notify==="function")if(this.observers.push(c),typeof c.onRegister==="function")try{c.onRegister()}catch(d){}};this.notifyObservers=function(c){for(var d=this.observers.length,a=0;a<d;a++)try{this.observers[a].notify(c,this)}catch(b){}}},instance:d})}})})();(function(){DevShop.Me({Observer:function(d){return DevShop.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(c,d){this.observable=d;if(typeof this[c]==="function")try{this[c]()}catch(a){}}},instance:d})}})})();(function(){DevShop.Me({ProxyInterface:{NAME:""},MediatorInterface:{NAME:"",listNotificationInterests:function(){},handleNotification:function(){}},CommandInterface:{execute:function(){}},Proxy:function(){var d={};this.facade=null;this.setData=function(c){d=c};this.getData=function(){return d};this.onRegister=function(){};this.onRemove=function(){}},Mediator:new DevShop.Observer(function(){this.facade=null;this.onRegister=function(){};this.onRemove=function(){}}),Facade:function(){var d=new function(){var a=
-{};this.facade={};this.registerProxy=function(b){b.facade=this.facade;a[b.NAME]||(a[b.NAME]=b);if(typeof b.onRegister==="function")b.onRegister()};this.retrieveProxy=function(b){return a[b]?a[b]:null};this.removeProxy=function(b){if(typeof a[b].onRemove==="function")try{a[b].onRemove()}catch(c){}a[b]=null}},c=new DevShop.Observable(function(){var a={};this.facade={};this.notification={};this.registerMediator=function(b){b.facade=this.facade;a[b.NAME]||(a[b.NAME]=b,this.addObserver(b))};this.retrieveMediator=
-function(b){return a[b]?a[b]:null};this.removeMediator=function(b){if(typeof a[b].onRemove==="function")try{a[b].onRemove()}catch(c){}a[b]=null};this.notifyObservers=function(a){for(var c=this.observers.length,d=0;d<c;d++)try{for(var e=this.observers[d].listNotificationInterests(),g=!1,f=0;l=e.length,f<l;f++)if(e[f]==this.notification.name){g=!0;break}if(g)this.observers[d].notification=this.notification,this.observers[d].notify(a,this)}catch(i){}};this.sendNotification=function(a){this.notification=
-a;this.notifyObservers("handleNotification")}}),e=new DevShop.Observer(function(){var a={},b=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(c,d){d.facade=this.facade;a[c]||(a[c]=d,b.push(c))};this.listNotificationInterests=function(){return b};this.handleNotification=function(){var b=this.notification;if(typeof a[b.name]==="object"&&typeof a[b.name].execute==="function")try{a[b.name].execute(b)}catch(c){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(a){d.registerProxy(a)};
-this.registerMediator=function(a){c.registerMediator(a)};this.registerCommand=function(a,b){e.registerCommand(a,b)};this.retrieveProxy=function(a){return d.retrieveProxy(a)};this.retrieveMediator=function(a){return c.retrieveMediator(a)};this.removeProxy=function(a){d.removeProxy(a)};this.removeMediator=function(a){c.removeMediator(a)};this.sendNotification=function(a,b,d){c.sendNotification({name:a,body:b,type:d})};this.initializeFacade=function(a){d.facade=a;c.facade=a;e.facade=a;a.registerMediator(e)}}})})();
+(function(){window.DevShop=typeof window.DevShop==="object"?window.DevShop:{};window.DevShop.Me=function(d){for(var c in d)d.hasOwnProperty(c)&&(window.DevShop[c]=d[c]);DevShop=devshop=window.DevShop}})();(function(){DevShop.Me({SingletonFactory:function(d){var c=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},e=c(d.implement),b=c(d.extend),c=c(d.instance),a;for(a in b)b.hasOwnProperty(a)&&(c[a]||(c[a]=b[a]));for(a in e)if(e.hasOwnProperty(a)&&!c[a])throw d.instance+" must implement '"+a+"' "+typeof e[a];if(typeof c.initialize==="function")try{c.initialize()}catch(g){}return c}})})();(function(){DevShop.Me({Observable:function(d){return DevShop.SingletonFactory({extend:function(){this.observers=[];this.addObserver=function(c){if((typeof c==="function"||typeof c==="object")&&typeof c.notify==="function")if(this.observers.push(c),typeof c.onRegister==="function")try{c.onRegister()}catch(d){}};this.notifyObservers=function(c){for(var d=this.observers.length,b=0;b<d;b++)try{this.observers[b].notify(c,this)}catch(a){}}},instance:d})}})})();(function(){DevShop.Me({Observer:function(d){return DevShop.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(c,d){this.observable=d;if(typeof this[c]==="function")try{this[c]()}catch(b){}}},instance:d})}})})();(function(){DevShop.Me({ProxyInterface:{NAME:""},MediatorInterface:{NAME:"",listNotificationInterests:function(){},handleNotification:function(){}},CommandInterface:{execute:function(){}},Proxy:function(){var d={};this.facade=null;this.setData=function(c){d=c};this.getData=function(){return d};this.onRegister=function(){};this.onRemove=function(){}},Mediator:new DevShop.Observer(function(){this.facade=null;this.onRegister=function(){};this.onRemove=function(){}}),Facade:function(){var d=new function(){var b=
+{};this.facade={};this.registerProxy=function(a){a.facade=this.facade;b[a.NAME]||(b[a.NAME]=a);if(typeof a.onRegister==="function")a.onRegister()};this.retrieveProxy=function(a){return b[a]?b[a]:null};this.removeProxy=function(a){if(typeof b[a].onRemove==="function")try{b[a].onRemove()}catch(c){}b[a]=null}},c=new DevShop.Observable(function(){var b={};this.facade={};this.notification={};this.registerMediator=function(a){a.facade=this.facade;b[a.NAME]||(b[a.NAME]=a,this.addObserver(a))};this.retrieveMediator=
+function(a){return b[a]?b[a]:null};this.removeMediator=function(a){if(typeof b[a].onRemove==="function")try{b[a].onRemove()}catch(c){}b[a]=null};this.notifyObservers=function(a){for(var b=this.observers.length,c=0;c<b;c++)try{for(var d=this.observers[c].listNotificationInterests(),e=!1,f=0;l=d.length,f<l;f++)if(d[f]==this.notification.name){e=!0;break}if(e)this.observers[c].notification=this.notification,this.observers[c].notify(a,this)}catch(h){}};this.sendNotification=function(a){this.notification=
+a;this.notifyObservers("handleNotification")}}),e=new DevShop.Observer(function(){var b={},a=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(c,d){d.facade=this.facade;b[c]||(b[c]=d,a.push(c))};this.listNotificationInterests=function(){return a};this.handleNotification=function(){var a=this.notification;if(typeof b[a.name]==="object"&&typeof b[a.name].execute==="function")try{b[a.name].execute(a)}catch(c){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(b){d.registerProxy(b)};
+this.registerMediator=function(b){c.registerMediator(b)};this.registerCommand=function(b,a){e.registerCommand(b,a)};this.retrieveProxy=function(b){return d.retrieveProxy(b)};this.retrieveMediator=function(b){return c.retrieveMediator(b)};this.removeProxy=function(b){d.removeProxy(b)};this.removeMediator=function(b){c.removeMediator(b)};this.sendNotification=function(b,a,d){c.sendNotification({name:b,body:a,type:d})};this.initializeFacade=function(){d.facade=this;c.facade=this;e.facade=this;this.registerMediator(e)}}})})();
View
2 examples/devshop-full.js
@@ -7,4 +7,4 @@
{};this.facade={};this.registerProxy=function(c){c.facade=this.facade;a[c.NAME]||(a[c.NAME]=c);if(typeof c.onRegister==="function")c.onRegister()};this.retrieveProxy=function(c){return a[c]?a[c]:null};this.removeProxy=function(c){if(typeof a[c].onRemove==="function")try{a[c].onRemove()}catch(b){}a[c]=null}},b=new DevShop.Observable(function(){var a={};this.facade={};this.notification={};this.registerMediator=function(c){c.facade=this.facade;a[c.NAME]||(a[c.NAME]=c,this.addObserver(c))};this.retrieveMediator=
function(c){return a[c]?a[c]:null};this.removeMediator=function(c){if(typeof a[c].onRemove==="function")try{a[c].onRemove()}catch(b){}a[c]=null};this.notifyObservers=function(a){for(var b=this.observers.length,d=0;d<b;d++)try{for(var e=this.observers[d].listNotificationInterests(),g=!1,f=0;l=e.length,f<l;f++)if(e[f]==this.notification.name){g=!0;break}if(g)this.observers[d].notification=this.notification,this.observers[d].notify(a,this)}catch(i){}};this.sendNotification=function(a){this.notification=
a;this.notifyObservers("handleNotification")}}),e=new DevShop.Observer(function(){var a={},c=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(b,d){d.facade=this.facade;a[b]||(a[b]=d,c.push(b))};this.listNotificationInterests=function(){return c};this.handleNotification=function(){var b=this.notification;if(typeof a[b.name]==="object"&&typeof a[b.name].execute==="function")try{a[b.name].execute(b)}catch(c){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(a){d.registerProxy(a)};
-this.registerMediator=function(a){b.registerMediator(a)};this.registerCommand=function(a,b){e.registerCommand(a,b)};this.retrieveProxy=function(a){return d.retrieveProxy(a)};this.retrieveMediator=function(a){return b.retrieveMediator(a)};this.removeProxy=function(a){d.removeProxy(a)};this.removeMediator=function(a){b.removeMediator(a)};this.sendNotification=function(a,c,d){b.sendNotification({name:a,body:c,type:d})};this.initializeFacade=function(a){d.facade=a;b.facade=a;e.facade=a;a.registerMediator(e)}}})})();
+this.registerMediator=function(a){b.registerMediator(a)};this.registerCommand=function(a,b){e.registerCommand(a,b)};this.retrieveProxy=function(a){return d.retrieveProxy(a)};this.retrieveMediator=function(a){return b.retrieveMediator(a)};this.removeProxy=function(a){d.removeProxy(a)};this.removeMediator=function(a){b.removeMediator(a)};this.sendNotification=function(a,c,d){b.sendNotification({name:a,body:c,type:d})};this.initializeFacade=function(){d.facade=this;b.facade=this;e.facade=this;this.registerMediator(e)}}})})();
View
2 examples/mvc.html
@@ -82,7 +82,7 @@
ON_KEYUP:"ON_KEYUP",
CMD_KEYUP:"CMD_KEYUP",
initialize:function(){
- this.initializeFacade(this);
+ this.initializeFacade();
this.registerCommand(this.CMD_STARTUP,StartUpCmd);
this.registerCommand(this.CMD_KEYUP,KeyUpCmd);
this.sendNotification(this.CMD_STARTUP);
View
8 src/mvc.js
@@ -167,10 +167,10 @@
type:type
});
};
- this.initializeFacade=function(app){
- initializeModel(app);
- initializeView(app);
- initializeController(app);
+ this.initializeFacade=function(){
+ initializeModel(this);
+ initializeView(this);
+ initializeController(this);
};
}
});

0 comments on commit 5280c0a

Please sign in to comment.