Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Revised coding pattern.

  • Loading branch information...
commit b128d3c642f5ba1fa827b49ca32fc678ffc5e660 1 parent c8f7561
@rgr-myrg authored
View
2  build/devshop-eventsignal.js
@@ -3,4 +3,4 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(a){a.DevShop=typeof a.DevShop==="object"?a.DevShop:{}})(window);(function(a){a.EventSignal=function(){var b=[];this.addListener=function(d){typeof d==="function"&&b.push(d)};this.removeListener=function(d){for(var a=b.length,c=0;c<a;c++)b[c]===d&&b.splice(c)};this.dispatch=function(){for(var a=b.length,e=0;e<a;e++)try{b[e].apply(this,arguments)}catch(c){}}}})(DevShop);
+(function(a){a.DevShop=typeof a.DevShop==="object"?a.DevShop:{}})(window);(function(a){a.EventSignal=function(){var b=[];return{addListener:function(d){typeof d==="function"&&b.push(d)},removeListener:function(d){for(var c=b.length,a=0;a<c;a++)b[a]===d&&(b[a]=null)},dispatch:function(){for(var a=b.length,c=0;c<a;c++)typeof b[c]==="function"&&b[c].apply(this,arguments)}}}})(DevShop);
View
10 build/devshop-full.js
@@ -3,8 +3,8 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(b){b.DevShop=typeof b.DevShop==="object"?b.DevShop:{}})(window);(function(b){b.SingletonFactory=function(e){var c=function(a){if(typeof a==="function")try{return new a}catch(d){}else if(typeof a==="object")return a},b=c(e.implement),a=c(e.extend),c=c(e.instance),d;for(d in a)a.hasOwnProperty(d)&&(c[d]||(c[d]=a[d]));for(d in b)if(b.hasOwnProperty(d)&&!c[d])throw e.instance+" must implement '"+d+"' "+typeof b[d];if(typeof c.initialize==="function")try{c.initialize()}catch(h){}return c}})(DevShop);(function(b){b.Observable=function(e){return b.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(b){}};this.notifyObservers=function(c){for(var b=this.observers.length,a=0;a<b;a++)try{this.observers[a].notify(c,this)}catch(d){}}},instance:e})}})(DevShop);(function(b){b.Observer=function(e){return b.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(c,b){this.observable=b;if(typeof this[c]==="function")try{this[c]()}catch(a){}}},instance:e})}})(DevShop);(function(b){b.EventSignal=function(){var b=[];this.addListener=function(c){typeof c==="function"&&b.push(c)};this.removeListener=function(c){for(var f=b.length,a=0;a<f;a++)b[a]===c&&b.splice(a)};this.dispatch=function(){for(var c=b.length,f=0;f<c;f++)try{b[f].apply(this,arguments)}catch(a){}}}})(DevShop);(function(b){b.IProxy={NAME:""};b.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};b.ICommand={execute:function(){}};b.Proxy=function(){var b={};this.facade=null;this.setData=function(c){b=c};this.getData=function(){return b};this.onRegister=function(){};this.onRemove=function(){}};b.Mediator=b.Observer(function(){this.facade=null;this.onRegister=function(){};this.onRemove=function(){}});b.Facade=function(){var e=new function(){var a={};this.facade={};this.registerProxy=
-function(d){d.facade=this.facade;a[d.NAME]||(a[d.NAME]=d);if(typeof d.onRegister==="function")try{d.onRegister()}catch(c){}};this.retrieveProxy=function(d){return a[d]?a[d]:null};this.removeProxy=function(d){if(typeof a[d].onRemove==="function")try{a[d].onRemove()}catch(c){}a[d]=null}},c=new b.Observable(function(){var a={};this.facade={};this.notification={};this.registerMediator=function(d){d.facade=this.facade;a[d.NAME]||(a[d.NAME]=d,this.addObserver(d))};this.retrieveMediator=function(d){return a[d]?
-a[d]:null};this.removeMediator=function(d){if(typeof a[d].onRemove==="function")try{a[d].onRemove()}catch(c){}a[d]=null};this.notifyObservers=function(a){for(var c=this.observers.length,b=0;b<c;b++)try{for(var e=this.observers[b].listNotificationInterests(),f=!1,g=0;l=e.length,g<l;g++)if(e[g]==this.notification.name){f=!0;break}if(f)this.observers[b].notification=this.notification,this.observers[b].notify(a,this)}catch(i){}};this.sendNotification=function(a){this.notification=a;this.notifyObservers("handleNotification")}}),
-f=new b.Observer(function(){var a={},c=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(b,e){e.facade=this.facade;a[b]||(a[b]=e,c.push(b))};this.listNotificationInterests=function(){return c};this.handleNotification=function(){var c=this.notification;if(typeof a[c.name]==="object"&&typeof a[c.name].execute==="function")try{a[c.name].execute(c)}catch(b){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(a){e.registerProxy(a)};this.registerMediator=function(a){c.registerMediator(a)};
-this.registerCommand=function(a,c){f.registerCommand(a,c)};this.retrieveProxy=function(a){return e.retrieveProxy(a)};this.retrieveMediator=function(a){return c.retrieveMediator(a)};this.removeProxy=function(a){e.removeProxy(a)};this.removeMediator=function(a){c.removeMediator(a)};this.sendNotification=function(a,b,e){c.sendNotification({name:a,body:b,type:e})};this.initializeFacade=function(){e.facade=this;c.facade=this;f.facade=this;this.registerMediator(f)}}})(DevShop);(function(b){b.Publisher=function(){var b={};return{registerEvents:function(c){typeof c==="object"&&(b=c)},registerSubscriber:function(c){if(typeof c.onRegister==="function"){var f=c.onRegister(),a;for(a in f)f.hasOwnProperty(a)&&typeof b[a]==="object"&&b[a].addListener(f[a]);c.onRegister=function(){}}},notify:function(c,b){typeof c.dispatch==="function"&&c.dispatch(b)}}}})(DevShop);
+(function(d){d.DevShop=typeof d.DevShop==="object"?d.DevShop:{}})(window);(function(d){d.SingletonFactory=function(c){var b=function(a){if(typeof a==="function")try{return new a}catch(e){}else if(typeof a==="object")return a},f=b(c.__implement),a=b(c.__extend),b=b(c.__construct),e;for(e in a)a.hasOwnProperty(e)&&(b[e]||(b[e]=a[e]));for(e in f)if(f.hasOwnProperty(e)&&!b[e])throw c.instance+" must implement '"+e+"' "+typeof f[e];if(typeof b.initialize==="function")try{b.initialize()}catch(d){}return b}})(DevShop);(function(d){d.Observable=function(c){return DevShop.SingletonFactory({__extend:function(){return{observers:[],addObserver:function(b){if((typeof b==="function"||typeof b==="object")&&typeof b.notify==="function")if(this.observers.push(b),typeof b.onRegister==="function")b.onRegister()},notifyObservers:function(b){for(var c=this.observers.length,a=0;a<c;a++)this.observers[a].notify(b,this)}}},__construct:c})}})(DevShop);(function(d){d.Observer=function(c){return DevShop.SingletonFactory({__extend:function(){return{onRegister:function(){},notify:function(b,c){this.observable=c;if(typeof this[b]==="function")try{this[b]()}catch(a){}}}},__construct:c})}})(DevShop);(function(d){d.EventSignal=function(){var c=[];return{addListener:function(b){typeof b==="function"&&c.push(b)},removeListener:function(b){for(var d=c.length,a=0;a<d;a++)c[a]===b&&(c[a]=null)},dispatch:function(){for(var b=c.length,d=0;d<b;d++)typeof c[d]==="function"&&c[d].apply(this,arguments)}}}})(DevShop);(function(d){d.IProxy={NAME:""};d.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};d.ICommand={execute:function(){}};d.Proxy=function(){var c={};return{facade:null,setData:function(b){c=b},getData:function(){return c},onRegister:function(){},onRemove:function(){}}};d.Mediator=d.Observer(function(){return{facade:null,onRegister:function(){},onRemove:function(){}}});d.Facade=function(){var c=new function(){var a={};return{facade:{},registerProxy:function(e){e.facade=
+this.facade;a[e.NAME]||(a[e.NAME]=e);if(typeof e.onRegister==="function")e.onRegister()},retrieveProxy:function(e){return a[e]?a[e]:null},removeProxy:function(e){if(typeof a[e].onRemove==="function")a[e].onRemove();a[e]=null}}},b=new d.Observable(function(){var a={};return{facade:{},notification:{},registerMediator:function(e){e.facade=this.facade;a[e.NAME]||(a[e.NAME]=e,this.addObserver(e))},retrieveMediator:function(e){return a[e]?a[e]:null},removeMediator:function(e){if(typeof a[e].onRemove===
+"function")a[e].onRemove();a[e]=null},notifyObservers:function(a){for(var b=this.observers.length,c=0;c<b;c++){for(var d=this.observers[c].listNotificationInterests(),f=!1,g=0;l=d.length,g<l;g++)if(d[g]==this.notification.name){f=!0;break}if(f)this.observers[c].notification=this.notification,this.observers[c].notify(a,this)}},sendNotification:function(a){this.notification=a;this.notifyObservers("handleNotification")}}}),f=new d.Observer(function(){var a={},b=[];return{facade:{},NAME:"BTG.Controller",
+registerCommand:function(c,d){d.facade=this.facade;a[c]||(a[c]=d,b.push(c))},listNotificationInterests:function(){return b},handleNotification:function(){var b=this.notification;typeof a[b.name]==="object"&&typeof a[b.name].execute==="function"&&a[b.name].execute(b)}}});return{CMD_STARTUP:"CMD_STARTUP",registerProxy:function(a){c.registerProxy(a)},registerMediator:function(a){b.registerMediator(a)},registerCommand:function(a,b){f.registerCommand(a,b)},retrieveProxy:function(a){return c.retrieveProxy(a)},
+retrieveMediator:function(a){return b.retrieveMediator(a)},removeProxy:function(a){c.removeProxy(a)},removeMediator:function(a){b.removeMediator(a)},sendNotification:function(a,c,d){b.sendNotification({name:a,body:c,type:d})},initializeFacade:function(){c.facade=this;b.facade=this;f.facade=this;this.registerMediator(f)}}}})(DevShop);(function(d){d.Publisher=function(){var c={};return{registerEvents:function(b){typeof b==="object"&&(c=b)},registerSubscriber:function(b){if(typeof b.onRegister==="function"){var d=b.onRegister(),a;for(a in d)d.hasOwnProperty(a)&&typeof c[a]==="object"&&c[a].addListener(d[a]);b.onRegister=function(){}}},notify:function(b,c){typeof b.dispatch==="function"&&b.dispatch(c)}}}})(DevShop);
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(b){b.DevShop=typeof b.DevShop==="object"?b.DevShop:{}})(window);(function(b){b.SingletonFactory=function(b){var d=function(a){if(typeof a==="function")try{return new a}catch(c){}else if(typeof a==="object")return a},f=d(b.implement),c=d(b.extend),d=d(b.instance),a;for(a in c)c.hasOwnProperty(a)&&(d[a]||(d[a]=c[a]));for(a in f)if(f.hasOwnProperty(a)&&!d[a])throw b.instance+" must implement '"+a+"' "+typeof f[a];if(typeof d.initialize==="function")try{d.initialize()}catch(g){}return d}})(DevShop);(function(b){b.Observable=function(e){return b.SingletonFactory({extend:function(){this.observers=[];this.addObserver=function(d){if((typeof d==="function"||typeof d==="object")&&typeof d.notify==="function")if(this.observers.push(d),typeof d.onRegister==="function")try{d.onRegister()}catch(b){}};this.notifyObservers=function(d){for(var b=this.observers.length,c=0;c<b;c++)try{this.observers[c].notify(d,this)}catch(a){}}},instance:e})}})(DevShop);(function(b){b.Observer=function(e){return b.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(d,b){this.observable=b;if(typeof this[d]==="function")try{this[d]()}catch(c){}}},instance:e})}})(DevShop);(function(b){b.IProxy={NAME:""};b.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};b.ICommand={execute:function(){}};b.Proxy=function(){var b={};this.facade=null;this.setData=function(d){b=d};this.getData=function(){return b};this.onRegister=function(){};this.onRemove=function(){}};b.Mediator=b.Observer(function(){this.facade=null;this.onRegister=function(){};this.onRemove=function(){}});b.Facade=function(){var e=new function(){var c={};this.facade={};this.registerProxy=
-function(a){a.facade=this.facade;c[a.NAME]||(c[a.NAME]=a);if(typeof a.onRegister==="function")try{a.onRegister()}catch(b){}};this.retrieveProxy=function(a){return c[a]?c[a]:null};this.removeProxy=function(a){if(typeof c[a].onRemove==="function")try{c[a].onRemove()}catch(b){}c[a]=null}},d=new b.Observable(function(){var c={};this.facade={};this.notification={};this.registerMediator=function(a){a.facade=this.facade;c[a.NAME]||(c[a.NAME]=a,this.addObserver(a))};this.retrieveMediator=function(a){return c[a]?
-c[a]:null};this.removeMediator=function(a){if(typeof c[a].onRemove==="function")try{c[a].onRemove()}catch(b){}c[a]=null};this.notifyObservers=function(a){for(var c=this.observers.length,b=0;b<c;b++)try{for(var d=this.observers[b].listNotificationInterests(),e=!1,f=0;l=d.length,f<l;f++)if(d[f]==this.notification.name){e=!0;break}if(e)this.observers[b].notification=this.notification,this.observers[b].notify(a,this)}catch(h){}};this.sendNotification=function(a){this.notification=a;this.notifyObservers("handleNotification")}}),
-f=new b.Observer(function(){var c={},a=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(b,d){d.facade=this.facade;c[b]||(c[b]=d,a.push(b))};this.listNotificationInterests=function(){return a};this.handleNotification=function(){var a=this.notification;if(typeof c[a.name]==="object"&&typeof c[a.name].execute==="function")try{c[a.name].execute(a)}catch(b){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(c){e.registerProxy(c)};this.registerMediator=function(c){d.registerMediator(c)};
-this.registerCommand=function(c,a){f.registerCommand(c,a)};this.retrieveProxy=function(c){return e.retrieveProxy(c)};this.retrieveMediator=function(c){return d.retrieveMediator(c)};this.removeProxy=function(c){e.removeProxy(c)};this.removeMediator=function(c){d.removeMediator(c)};this.sendNotification=function(c,a,b){d.sendNotification({name:c,body:a,type:b})};this.initializeFacade=function(){e.facade=this;d.facade=this;f.facade=this;this.registerMediator(f)}}})(DevShop);
+(function(c){c.DevShop=typeof c.DevShop==="object"?c.DevShop:{}})(window);(function(c){c.SingletonFactory=function(c){var d=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},e=d(c.__implement),b=d(c.__extend),d=d(c.__construct),a;for(a in b)b.hasOwnProperty(a)&&(d[a]||(d[a]=b[a]));for(a in e)if(e.hasOwnProperty(a)&&!d[a])throw c.instance+" must implement '"+a+"' "+typeof e[a];if(typeof d.initialize==="function")try{d.initialize()}catch(g){}return d}})(DevShop);(function(c){c.Observable=function(c){return DevShop.SingletonFactory({__extend:function(){return{observers:[],addObserver:function(d){if((typeof d==="function"||typeof d==="object")&&typeof d.notify==="function")if(this.observers.push(d),typeof d.onRegister==="function")d.onRegister()},notifyObservers:function(d){for(var c=this.observers.length,b=0;b<c;b++)this.observers[b].notify(d,this)}}},__construct:c})}})(DevShop);(function(c){c.Observer=function(c){return DevShop.SingletonFactory({__extend:function(){return{onRegister:function(){},notify:function(c,e){this.observable=e;if(typeof this[c]==="function")try{this[c]()}catch(b){}}}},__construct:c})}})(DevShop);(function(c){c.IProxy={NAME:""};c.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};c.ICommand={execute:function(){}};c.Proxy=function(){var c={};return{facade:null,setData:function(d){c=d},getData:function(){return c},onRegister:function(){},onRemove:function(){}}};c.Mediator=c.Observer(function(){return{facade:null,onRegister:function(){},onRemove:function(){}}});c.Facade=function(){var f=new function(){var b={};return{facade:{},registerProxy:function(a){a.facade=
+this.facade;b[a.NAME]||(b[a.NAME]=a);if(typeof a.onRegister==="function")a.onRegister()},retrieveProxy:function(a){return b[a]?b[a]:null},removeProxy:function(a){if(typeof b[a].onRemove==="function")b[a].onRemove();b[a]=null}}},d=new c.Observable(function(){var b={};return{facade:{},notification:{},registerMediator:function(a){a.facade=this.facade;b[a.NAME]||(b[a.NAME]=a,this.addObserver(a))},retrieveMediator:function(a){return b[a]?b[a]:null},removeMediator:function(a){if(typeof b[a].onRemove===
+"function")b[a].onRemove();b[a]=null},notifyObservers:function(a){for(var b=this.observers.length,c=0;c<b;c++){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)}},sendNotification:function(a){this.notification=a;this.notifyObservers("handleNotification")}}}),e=new c.Observer(function(){var b={},a=[];return{facade:{},NAME:"BTG.Controller",
+registerCommand:function(c,d){d.facade=this.facade;b[c]||(b[c]=d,a.push(c))},listNotificationInterests:function(){return a},handleNotification:function(){var a=this.notification;typeof b[a.name]==="object"&&typeof b[a.name].execute==="function"&&b[a.name].execute(a)}}});return{CMD_STARTUP:"CMD_STARTUP",registerProxy:function(b){f.registerProxy(b)},registerMediator:function(b){d.registerMediator(b)},registerCommand:function(b,a){e.registerCommand(b,a)},retrieveProxy:function(b){return f.retrieveProxy(b)},
+retrieveMediator:function(b){return d.retrieveMediator(b)},removeProxy:function(b){f.removeProxy(b)},removeMediator:function(b){d.removeMediator(b)},sendNotification:function(b,a,c){d.sendNotification({name:b,body:a,type:c})},initializeFacade:function(){f.facade=this;d.facade=this;e.facade=this;this.registerMediator(e)}}}})(DevShop);
View
2  build/devshop-observer.js
@@ -3,4 +3,4 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(b){b.DevShop=typeof b.DevShop==="object"?b.DevShop:{}})(window);(function(b){b.SingletonFactory=function(b){var a=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},f=a(b.implement),d=a(b.extend),a=a(b.instance),c;for(c in d)d.hasOwnProperty(c)&&(a[c]||(a[c]=d[c]));for(c in f)if(f.hasOwnProperty(c)&&!a[c])throw b.instance+" must implement '"+c+"' "+typeof f[c];if(typeof a.initialize==="function")try{a.initialize()}catch(g){}return a}})(DevShop);(function(b){b.Observable=function(e){return b.SingletonFactory({extend:function(){this.observers=[];this.addObserver=function(a){if((typeof a==="function"||typeof a==="object")&&typeof a.notify==="function")if(this.observers.push(a),typeof a.onRegister==="function")try{a.onRegister()}catch(b){}};this.notifyObservers=function(a){for(var b=this.observers.length,d=0;d<b;d++)try{this.observers[d].notify(a,this)}catch(c){}}},instance:e})}})(DevShop);(function(b){b.Observer=function(e){return b.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(a,b){this.observable=b;if(typeof this[a]==="function")try{this[a]()}catch(d){}}},instance:e})}})(DevShop);
+(function(b){b.DevShop=typeof b.DevShop==="object"?b.DevShop:{}})(window);(function(b){b.SingletonFactory=function(b){var a=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},e=a(b.__implement),d=a(b.__extend),a=a(b.__construct),c;for(c in d)d.hasOwnProperty(c)&&(a[c]||(a[c]=d[c]));for(c in e)if(e.hasOwnProperty(c)&&!a[c])throw b.instance+" must implement '"+c+"' "+typeof e[c];if(typeof a.initialize==="function")try{a.initialize()}catch(f){}return a}})(DevShop);(function(b){b.Observable=function(b){return DevShop.SingletonFactory({__extend:function(){return{observers:[],addObserver:function(a){if((typeof a==="function"||typeof a==="object")&&typeof a.notify==="function")if(this.observers.push(a),typeof a.onRegister==="function")a.onRegister()},notifyObservers:function(a){for(var b=this.observers.length,d=0;d<b;d++)this.observers[d].notify(a,this)}}},__construct:b})}})(DevShop);(function(b){b.Observer=function(b){return DevShop.SingletonFactory({__extend:function(){return{onRegister:function(){},notify:function(a,b){this.observable=b;if(typeof this[a]==="function")try{this[a]()}catch(d){}}}},__construct:b})}})(DevShop);
View
2  build/devshop-singletonfactory.js
@@ -3,4 +3,4 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(a){a.DevShop=typeof a.DevShop==="object"?a.DevShop:{}})(window);(function(a){a.SingletonFactory=function(a){var b=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},d=b(a.implement),e=b(a.extend),b=b(a.instance),c;for(c in e)e.hasOwnProperty(c)&&(b[c]||(b[c]=e[c]));for(c in d)if(d.hasOwnProperty(c)&&!b[c])throw a.instance+" must implement '"+c+"' "+typeof d[c];if(typeof b.initialize==="function")try{b.initialize()}catch(f){}return b}})(DevShop);
+(function(a){a.DevShop=typeof a.DevShop==="object"?a.DevShop:{}})(window);(function(a){a.SingletonFactory=function(a){var b=function(a){if(typeof a==="function")try{return new a}catch(b){}else if(typeof a==="object")return a},d=b(a.__implement),e=b(a.__extend),b=b(a.__construct),c;for(c in e)e.hasOwnProperty(c)&&(b[c]||(b[c]=e[c]));for(c in d)if(d.hasOwnProperty(c)&&!b[c])throw a.instance+" must implement '"+c+"' "+typeof d[c];if(typeof b.initialize==="function")try{b.initialize()}catch(f){}return b}})(DevShop);
View
10 examples/devshop-full.js
@@ -3,8 +3,8 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(b){b.DevShop=typeof b.DevShop==="object"?b.DevShop:{}})(window);(function(b){b.SingletonFactory=function(e){var c=function(a){if(typeof a==="function")try{return new a}catch(d){}else if(typeof a==="object")return a},b=c(e.implement),a=c(e.extend),c=c(e.instance),d;for(d in a)a.hasOwnProperty(d)&&(c[d]||(c[d]=a[d]));for(d in b)if(b.hasOwnProperty(d)&&!c[d])throw e.instance+" must implement '"+d+"' "+typeof b[d];if(typeof c.initialize==="function")try{c.initialize()}catch(h){}return c}})(DevShop);(function(b){b.Observable=function(e){return b.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(b){}};this.notifyObservers=function(c){for(var b=this.observers.length,a=0;a<b;a++)try{this.observers[a].notify(c,this)}catch(d){}}},instance:e})}})(DevShop);(function(b){b.Observer=function(e){return b.SingletonFactory({extend:function(){this.onRegister=function(){};this.notify=function(c,b){this.observable=b;if(typeof this[c]==="function")try{this[c]()}catch(a){}}},instance:e})}})(DevShop);(function(b){b.EventSignal=function(){var b=[];this.addListener=function(c){typeof c==="function"&&b.push(c)};this.removeListener=function(c){for(var f=b.length,a=0;a<f;a++)b[a]===c&&b.splice(a)};this.dispatch=function(){for(var c=b.length,f=0;f<c;f++)try{b[f].apply(this,arguments)}catch(a){}}}})(DevShop);(function(b){b.IProxy={NAME:""};b.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};b.ICommand={execute:function(){}};b.Proxy=function(){var b={};this.facade=null;this.setData=function(c){b=c};this.getData=function(){return b};this.onRegister=function(){};this.onRemove=function(){}};b.Mediator=b.Observer(function(){this.facade=null;this.onRegister=function(){};this.onRemove=function(){}});b.Facade=function(){var e=new function(){var a={};this.facade={};this.registerProxy=
-function(d){d.facade=this.facade;a[d.NAME]||(a[d.NAME]=d);if(typeof d.onRegister==="function")try{d.onRegister()}catch(c){}};this.retrieveProxy=function(d){return a[d]?a[d]:null};this.removeProxy=function(d){if(typeof a[d].onRemove==="function")try{a[d].onRemove()}catch(c){}a[d]=null}},c=new b.Observable(function(){var a={};this.facade={};this.notification={};this.registerMediator=function(d){d.facade=this.facade;a[d.NAME]||(a[d.NAME]=d,this.addObserver(d))};this.retrieveMediator=function(d){return a[d]?
-a[d]:null};this.removeMediator=function(d){if(typeof a[d].onRemove==="function")try{a[d].onRemove()}catch(c){}a[d]=null};this.notifyObservers=function(a){for(var c=this.observers.length,b=0;b<c;b++)try{for(var e=this.observers[b].listNotificationInterests(),f=!1,g=0;l=e.length,g<l;g++)if(e[g]==this.notification.name){f=!0;break}if(f)this.observers[b].notification=this.notification,this.observers[b].notify(a,this)}catch(i){}};this.sendNotification=function(a){this.notification=a;this.notifyObservers("handleNotification")}}),
-f=new b.Observer(function(){var a={},c=[];this.facade={};this.NAME="DevShop.Controller";this.registerCommand=function(b,e){e.facade=this.facade;a[b]||(a[b]=e,c.push(b))};this.listNotificationInterests=function(){return c};this.handleNotification=function(){var c=this.notification;if(typeof a[c.name]==="object"&&typeof a[c.name].execute==="function")try{a[c.name].execute(c)}catch(b){}}});this.CMD_STARTUP="CMD_STARTUP";this.registerProxy=function(a){e.registerProxy(a)};this.registerMediator=function(a){c.registerMediator(a)};
-this.registerCommand=function(a,c){f.registerCommand(a,c)};this.retrieveProxy=function(a){return e.retrieveProxy(a)};this.retrieveMediator=function(a){return c.retrieveMediator(a)};this.removeProxy=function(a){e.removeProxy(a)};this.removeMediator=function(a){c.removeMediator(a)};this.sendNotification=function(a,b,e){c.sendNotification({name:a,body:b,type:e})};this.initializeFacade=function(){e.facade=this;c.facade=this;f.facade=this;this.registerMediator(f)}}})(DevShop);(function(b){b.Publisher=function(){var b={};return{registerEvents:function(c){typeof c==="object"&&(b=c)},registerSubscriber:function(c){if(typeof c.onRegister==="function"){var f=c.onRegister(),a;for(a in f)f.hasOwnProperty(a)&&typeof b[a]==="object"&&b[a].addListener(f[a]);c.onRegister=function(){}}},notify:function(c,b){typeof c.dispatch==="function"&&c.dispatch(b)}}}})(DevShop);
+(function(d){d.DevShop=typeof d.DevShop==="object"?d.DevShop:{}})(window);(function(d){d.SingletonFactory=function(c){var b=function(a){if(typeof a==="function")try{return new a}catch(e){}else if(typeof a==="object")return a},f=b(c.__implement),a=b(c.__extend),b=b(c.__construct),e;for(e in a)a.hasOwnProperty(e)&&(b[e]||(b[e]=a[e]));for(e in f)if(f.hasOwnProperty(e)&&!b[e])throw c.instance+" must implement '"+e+"' "+typeof f[e];if(typeof b.initialize==="function")try{b.initialize()}catch(d){}return b}})(DevShop);(function(d){d.Observable=function(c){return DevShop.SingletonFactory({__extend:function(){return{observers:[],addObserver:function(b){if((typeof b==="function"||typeof b==="object")&&typeof b.notify==="function")if(this.observers.push(b),typeof b.onRegister==="function")b.onRegister()},notifyObservers:function(b){for(var c=this.observers.length,a=0;a<c;a++)this.observers[a].notify(b,this)}}},__construct:c})}})(DevShop);(function(d){d.Observer=function(c){return DevShop.SingletonFactory({__extend:function(){return{onRegister:function(){},notify:function(b,c){this.observable=c;if(typeof this[b]==="function")try{this[b]()}catch(a){}}}},__construct:c})}})(DevShop);(function(d){d.EventSignal=function(){var c=[];return{addListener:function(b){typeof b==="function"&&c.push(b)},removeListener:function(b){for(var d=c.length,a=0;a<d;a++)c[a]===b&&(c[a]=null)},dispatch:function(){for(var b=c.length,d=0;d<b;d++)typeof c[d]==="function"&&c[d].apply(this,arguments)}}}})(DevShop);(function(d){d.IProxy={NAME:""};d.IMediator={NAME:"",listNotificationInterests:function(){},handleNotification:function(){}};d.ICommand={execute:function(){}};d.Proxy=function(){var c={};return{facade:null,setData:function(b){c=b},getData:function(){return c},onRegister:function(){},onRemove:function(){}}};d.Mediator=d.Observer(function(){return{facade:null,onRegister:function(){},onRemove:function(){}}});d.Facade=function(){var c=new function(){var a={};return{facade:{},registerProxy:function(e){e.facade=
+this.facade;a[e.NAME]||(a[e.NAME]=e);if(typeof e.onRegister==="function")e.onRegister()},retrieveProxy:function(e){return a[e]?a[e]:null},removeProxy:function(e){if(typeof a[e].onRemove==="function")a[e].onRemove();a[e]=null}}},b=new d.Observable(function(){var a={};return{facade:{},notification:{},registerMediator:function(e){e.facade=this.facade;a[e.NAME]||(a[e.NAME]=e,this.addObserver(e))},retrieveMediator:function(e){return a[e]?a[e]:null},removeMediator:function(e){if(typeof a[e].onRemove===
+"function")a[e].onRemove();a[e]=null},notifyObservers:function(a){for(var b=this.observers.length,c=0;c<b;c++){for(var d=this.observers[c].listNotificationInterests(),f=!1,g=0;l=d.length,g<l;g++)if(d[g]==this.notification.name){f=!0;break}if(f)this.observers[c].notification=this.notification,this.observers[c].notify(a,this)}},sendNotification:function(a){this.notification=a;this.notifyObservers("handleNotification")}}}),f=new d.Observer(function(){var a={},b=[];return{facade:{},NAME:"BTG.Controller",
+registerCommand:function(c,d){d.facade=this.facade;a[c]||(a[c]=d,b.push(c))},listNotificationInterests:function(){return b},handleNotification:function(){var b=this.notification;typeof a[b.name]==="object"&&typeof a[b.name].execute==="function"&&a[b.name].execute(b)}}});return{CMD_STARTUP:"CMD_STARTUP",registerProxy:function(a){c.registerProxy(a)},registerMediator:function(a){b.registerMediator(a)},registerCommand:function(a,b){f.registerCommand(a,b)},retrieveProxy:function(a){return c.retrieveProxy(a)},
+retrieveMediator:function(a){return b.retrieveMediator(a)},removeProxy:function(a){c.removeProxy(a)},removeMediator:function(a){b.removeMediator(a)},sendNotification:function(a,c,d){b.sendNotification({name:a,body:c,type:d})},initializeFacade:function(){c.facade=this;b.facade=this;f.facade=this;this.registerMediator(f)}}}})(DevShop);(function(d){d.Publisher=function(){var c={};return{registerEvents:function(b){typeof b==="object"&&(c=b)},registerSubscriber:function(b){if(typeof b.onRegister==="function"){var d=b.onRegister(),a;for(a in d)d.hasOwnProperty(a)&&typeof c[a]==="object"&&c[a].addListener(d[a]);b.onRegister=function(){}}},notify:function(b,c){typeof b.dispatch==="function"&&b.dispatch(c)}}}})(DevShop);
View
24 examples/mvc.html
@@ -30,15 +30,15 @@
}
};
var DataProxy=DevShop.SingletonFactory({
- extend : DevShop.Proxy,
- implement : DevShop.IProxy,
- instance : {
+ __extend : DevShop.Proxy,
+ __implement : DevShop.IProxy,
+ __construct : {
NAME:"DataProxy"
}
});
var StartUpCmd=DevShop.SingletonFactory({
- implement : DevShop.ICommand,
- instance : {
+ __implement : DevShop.ICommand,
+ __construct : {
execute:function(notification){
this.facade.registerProxy(DataProxy);
this.facade.registerMediator(UIMediator);
@@ -46,8 +46,8 @@
}
});
var KeyUpCmd=DevShop.SingletonFactory({
- implement : DevShop.ICommand,
- instance : {
+ __implement : DevShop.ICommand,
+ __construct : {
execute:function(notification){
var msg=this.facade.retrieveProxy(DataProxy.NAME).getData();
Echo.onKeyUp(msg);
@@ -57,9 +57,9 @@
}
});
var UIMediator=DevShop.SingletonFactory({
- extend : DevShop.Mediator,
- implement : DevShop.IMediator,
- instance : {
+ __extend : DevShop.Mediator,
+ __implement : DevShop.IMediator,
+ __construct : {
NAME:"UIMediator",
listNotificationInterests:function(){
return [this.facade.ON_KEYUP];
@@ -77,8 +77,8 @@
}
});
var UI=DevShop.SingletonFactory({
- extend:DevShop.Facade,
- instance:{
+ __extend:DevShop.Facade,
+ __construct:{
ON_KEYUP:"ON_KEYUP",
CMD_KEYUP:"CMD_KEYUP",
initialize:function(){
View
4 examples/pubsub.html
@@ -62,8 +62,8 @@
//Alternate way of 'extending' the publisher example:
var UIx=new DevShop.SingletonFactory({
- extend: DevShop.Publisher,
- instance:function(){
+ __extend: DevShop.Publisher,
+ __construct:function(){
this.onKeyUp=function(){
var data = document.getElementById('box').value;
this.notify(Events.ON_KEYUP, data);
View
18 examples/singleton.html
@@ -8,20 +8,20 @@
<script type="text/javascript" src="devshop-full.js"></script>
<script type="text/javascript">
//Create a single instance. Nothing fancy here.
- var TheWiz=new DevShop.SingletonFactory({
- instance:function(){
- var msg="I'm the Wiz";
- this.getMsg=function(){
+ var TheWiz = new DevShop.SingletonFactory({
+ __construct : function(){
+ var msg = "I'm the Wiz";
+ this.getMsg = function(){
return msg;
};
}
});
//Easily extend from an instance. Example: extend 'TheWiz'
- var WizBang=new DevShop.SingletonFactory({
- extend: TheWiz,
- instance:function(){
- var msg=" and nobody beats me!";
- this.sayIt=function(){
+ var WizBang = new DevShop.SingletonFactory({
+ __extend : TheWiz,
+ __construct :function(){
+ var msg = " and nobody beats me!";
+ this.sayIt = function(){
return this.getMsg() + msg;
};
}
View
2  src/core.js
@@ -4,5 +4,5 @@
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
(function(window){
- window.DevShop=typeof window.DevShop==='object'?window.DevShop:{};
+ window.DevShop = typeof window.DevShop === 'object' ? window.DevShop : {};
})(window);
View
325 src/mvc.js
@@ -3,173 +3,186 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(DevShop){
- DevShop.IProxy={
- NAME:""
+(function($){
+ $.IProxy = {
+ NAME : ""
};
- DevShop.IMediator={
- NAME:"",
- listNotificationInterests:function(){},
- handleNotification:function(){}
+ $.IMediator = {
+ NAME : "",
+ listNotificationInterests : function(){},
+ handleNotification : function(){}
};
- DevShop.ICommand={
- execute:function(notification){}
+ $.ICommand = {
+ execute : function(notification){}
};
- DevShop.Proxy=function(){
- var data={};
- this.facade=null;
- this.setData=function(obj){
- data=obj;
- };
- this.getData=function(){
- return data;
- };
- this.onRegister=function(){
- return;
- };
- this.onRemove=function(){
- return;
- };
+ $.Proxy = function(){
+ var data = {};
+ return {
+ facade : null,
+ setData : function(obj){
+ data = obj;
+ },
+ getData : function(){
+ return data;
+ },
+ onRegister : function(){
+ return;
+ },
+ onRemove : function(){
+ return;
+ }
+ }
};
- DevShop.Mediator=DevShop.Observer(function(){
- this.facade=null;
- this.onRegister=function(){
- return;
- };
- this.onRemove=function(){
- return;
+ $.Mediator = $.Observer(function(){
+ return {
+ facade : null,
+ onRegister : function(){
+ return;
+ },
+ onRemove : function(){
+ return;
+ }
};
});
- DevShop.Facade=function(){
- var Model=new function(){
- var proxies={};
- this.facade={};
- this.registerProxy=function(proxy){
- proxy.facade=this.facade;
- if(!proxies[proxy.NAME])
- proxies[proxy.NAME]=proxy;
- if(typeof proxy.onRegister==="function")
- try{proxy.onRegister();}catch(e){}
- };
- this.retrieveProxy=function(key){
- return proxies[key]?proxies[key]:null;
- };
- this.removeProxy=function(key){
- if(typeof proxies[key].onRemove==="function")
- try{proxies[key].onRemove();}catch(e){}
- proxies[key]=null;
- };
- };
- var View=new DevShop.Observable(function(){
- var mediators={};
- this.facade={};
- this.notification={};
- this.registerMediator=function(mediator){
- mediator.facade=this.facade;
- if(!mediators[mediator.NAME]){
- mediators[mediator.NAME]=mediator;
- this.addObserver(mediator);
- }
- };
- this.retrieveMediator=function(key){
- return mediators[key]?mediators[key]:null;
- };
- this.removeMediator=function(key){
- if(typeof mediators[key].onRemove==="function")
- try{mediators[key].onRemove();}catch(e){}
- mediators[key]=null;
- };
- this.notifyObservers=function(eventName){
- var size=this.observers.length;
- for(var x=0;x<size;x++){
- try{
- var notices=this.observers[x].listNotificationInterests();
- var deliver=false;
- for(var i=0;l=notices.length,i<l;i++){
- if(notices[i]==this.notification.name){
- deliver=true;
- break;
+ $.Facade = function(){
+ var Model = new function(){
+ var proxies = {};
+ return {
+ facade : {},
+ registerProxy : function(proxy){
+ proxy.facade = this.facade;
+ if(!proxies[proxy.NAME]){
+ proxies[proxy.NAME] = proxy;
+ }
+ if(typeof proxy.onRegister === "function"){
+ proxy.onRegister();
+ }
+ },
+ retrieveProxy : function(key){
+ return proxies[key] ? proxies[key] : null;
+ },
+ removeProxy : function(key){
+ if(typeof proxies[key].onRemove === "function"){
+ proxies[key].onRemove();
+ }
+ proxies[key] = null;
+ }
+ };
+ },
+ View = new $.Observable(function(){
+ var mediators = {};
+ return {
+ facade : {},
+ notification : {},
+ registerMediator : function(mediator){
+ mediator.facade = this.facade;
+ if(!mediators[mediator.NAME]){
+ mediators[mediator.NAME] = mediator;
+ this.addObserver(mediator);
+ }
+ },
+ retrieveMediator : function(key){
+ return mediators[key] ? mediators[key] : null;
+ },
+ removeMediator : function(key){
+ if(typeof mediators[key].onRemove === "function"){
+ mediators[key].onRemove();
+ }
+ mediators[key] = null;
+ },
+ notifyObservers : function(eventName){
+ var size = this.observers.length;
+ for(var x = 0; x < size; x++){
+ var notices = this.observers[x].listNotificationInterests();
+ var deliver = false;
+ for(var i = 0; l = notices.length, i<l; i++){
+ if(notices[i] == this.notification.name){
+ deliver = true;
+ break;
+ }
+ }
+ if(deliver){
+ this.observers[x].notification = this.notification;
+ this.observers[x].notify(eventName,this);
}
}
- if(deliver){
- this.observers[x].notification=this.notification;
- this.observers[x].notify(eventName,this);
+ },
+ sendNotification : function(notification){
+ this.notification = notification;
+ this.notifyObservers('handleNotification');
+ }
+ };
+ }),
+ Controller = new $.Observer(function(){
+ var commands = {},
+ notifications = [];
+ return {
+ facade : {},
+ NAME : "BTG.Controller",
+ registerCommand : function(key, command){
+ command.facade = this.facade;
+ if(!commands[key]){
+ commands[key] = command;
+ notifications.push(key);
}
- }catch(e){}
- }
- };
- this.sendNotification=function(notification){
- this.notification=notification;
- this.notifyObservers('handleNotification');
- };
- });
- var Controller=new DevShop.Observer(function(){
- var commands={};
- var notifications=[];
- this.facade={};
- this.NAME="DevShop.Controller";
- this.registerCommand=function(key,command){
- command.facade=this.facade;
- if(!commands[key]){
- commands[key]=command;
- notifications.push(key);
- }
- };
- this.listNotificationInterests=function(){
- return notifications;
- };
- this.handleNotification=function(){
- var notification=this.notification;
- if(typeof commands[notification.name]==="object")
- if(typeof commands[notification.name].execute==="function")
- try{
+ },
+ listNotificationInterests : function(){
+ return notifications;
+ },
+ handleNotification : function(){
+ var notification = this.notification;
+ if(typeof commands[notification.name] === "object"
+ && typeof commands[notification.name].execute === "function"){
commands[notification.name].execute(notification);
- }catch(e){}
+ }
+ }
+ };
+ }),
+ initializeModel = function(app){
+ Model.facade = app;
+ },
+ initializeView = function(app){
+ View.facade = app;
+ },
+ initializeController = function(app){
+ Controller.facade = app;
+ app.registerMediator(Controller);
};
- });
- var initializeModel=function(app){
- Model.facade=app;
- };
- var initializeView=function(app){
- View.facade=app;
- };
- var initializeController=function(app){
- Controller.facade=app;
- app.registerMediator(Controller);
- };
- this.CMD_STARTUP="CMD_STARTUP";
- this.registerProxy=function(proxy){
- Model.registerProxy(proxy);
- };
- this.registerMediator=function(mediator){
- View.registerMediator(mediator);
- };
- this.registerCommand=function(key,command){
- Controller.registerCommand(key,command);
- };
- this.retrieveProxy=function(key){
- return Model.retrieveProxy(key);
- };
- this.retrieveMediator=function(key){
- return View.retrieveMediator(key);
- };
- this.removeProxy=function(key){
- Model.removeProxy(key);
- };
- this.removeMediator=function(key){
- View.removeMediator(key);
- };
- this.sendNotification=function(name,body,type){
- View.sendNotification({
- name:name,
- body:body,
- type:type
- });
- };
- this.initializeFacade=function(){
- initializeModel(this);
- initializeView(this);
- initializeController(this);
+ return {
+ CMD_STARTUP : "CMD_STARTUP",
+ registerProxy : function(proxy){
+ Model.registerProxy(proxy);
+ },
+ registerMediator : function(mediator){
+ View.registerMediator(mediator);
+ },
+ registerCommand : function(key,command){
+ Controller.registerCommand(key,command);
+ },
+ retrieveProxy : function(key){
+ return Model.retrieveProxy(key);
+ },
+ retrieveMediator : function(key){
+ return View.retrieveMediator(key);
+ },
+ removeProxy : function(key){
+ Model.removeProxy(key);
+ },
+ removeMediator : function(key){
+ View.removeMediator(key);
+ },
+ sendNotification : function(name, body, type){
+ View.sendNotification({
+ name : name,
+ body : body,
+ type : type
+ });
+ },
+ initializeFacade : function(){
+ initializeModel(this);
+ initializeView(this);
+ initializeController(this);
+ }
};
};
})(DevShop);
View
40 src/observable.js
@@ -3,33 +3,33 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(DevShop){
- DevShop.Observable=function(obj){
- var observable=function(){
- this.observers=[];
- this.addObserver=function(o){
- if(typeof o==="function"||typeof o==="object"){
- if(typeof o.notify==="function"){
+(function($){
+ $.Observable = function(obj){
+ var observable = function(){
+ return {
+ observers : [],
+ addObserver : function(o){
+ if((typeof o === "function" || typeof o === "object")
+ && typeof o.notify === "function"){
this.observers.push(o);
- if(typeof o.onRegister==="function"){
- try{
- o.onRegister();
- }catch(e){
- }
+ if(typeof o.onRegister === "function"){
+ o.onRegister();
}
}
- }
- };
- this.notifyObservers=function(eventName){
- var size=this.observers.length;
- for(var x=0;x<size;x++){
- try{
+ },
+ notifyObservers : function(eventName){
+ var size = this.observers.length;
+ for(var x = 0; x < size; x++){
this.observers[x].notify(eventName,this);
- }catch(e){
}
}
};
};
- return DevShop.SingletonFactory({extend:observable,instance:obj});
+ return DevShop.SingletonFactory(
+ {
+ __extend : observable,
+ __construct : obj
+ }
+ );
};
})(DevShop);
View
30 src/observer.js
@@ -3,20 +3,28 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(DevShop){
- DevShop.Observer=function(obj){
- var observer=function(){
- this.onRegister=function(){};
- this.notify=function(eventName,observable){
- this.observable=observable;
- if(typeof this[eventName]==="function"){
- try{
- this[eventName]();
- }catch(e){
+(function($){
+ $.Observer = function(obj){
+ var observer = function(obj){
+ return {
+ onRegister : function(){
+ },
+ notify : function(eventName, observable){
+ this.observable = observable;
+ if(typeof this[eventName] === 'function'){
+ try{
+ this[eventName]();
+ }catch(e){
+ }
}
}
};
};
- return DevShop.SingletonFactory({extend:observer,instance:obj});
+ return DevShop.SingletonFactory(
+ {
+ __extend : observer,
+ __construct: obj
+ }
+ );
};
})(DevShop);
View
14 src/publisher.js
@@ -3,16 +3,16 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(DevShop){
- DevShop.Publisher=function(){
- var events={};
+(function($){
+ $.Publisher = function(){
+ var events = {};
return {
- registerEvents: function(eventList){
+ registerEvents : function(eventList){
if(typeof eventList === 'object'){
events = eventList;
}
},
- registerSubscriber: function(subscriber){
+ registerSubscriber : function(subscriber){
if(typeof subscriber.onRegister === 'function'){
var listeners = subscriber.onRegister();
for(var i in listeners){
@@ -20,10 +20,10 @@
events[i].addListener(listeners[i]);
}
}
- subscriber.onRegister=function(){};
+ subscriber.onRegister = function(){};
}
},
- notify: function(event, data){
+ notify : function(event, data){
if(typeof event.dispatch === 'function'){
event.dispatch(data);
}
View
24 src/singletonfactory.js
@@ -3,36 +3,36 @@
* Released under the MIT license:
* https://github.com/rgr-myrg/DevShop-JS/raw/master/MIT-LICENSE
*/
-(function(DevShop){
- DevShop.SingletonFactory=function(obj){
- var getInstance=function(c){
- if(typeof c==="function"){
+(function($){
+ $.SingletonFactory = function(obj){
+ var getInstance = function(c){
+ if(typeof c === "function"){
try{
return new c;
}catch(e){
}
- }else if(typeof c==="object"){
+ }else if(typeof c === "object"){
return c;
}
- };
- var interfase=getInstance(obj.implement);
- var baseclass=getInstance(obj.extend);
- var singleton=getInstance(obj.instance);
+ },
+ interfase = getInstance(obj.__implement),
+ baseclass = getInstance(obj.__extend),
+ singleton = getInstance(obj.__construct);
for(var i in baseclass){
if(baseclass.hasOwnProperty(i)){
if(!singleton[i]){
- singleton[i]=baseclass[i];
+ singleton[i] = baseclass[i];
}
}
}
for(var i in interfase){
if(interfase.hasOwnProperty(i)){
if(!singleton[i]){
- throw(obj.instance + " must implement '"+i+"' "+typeof interfase[i]);
+ throw(obj.instance + " must implement '" + i + "' " + typeof interfase[i]);
}
}
}
- if(typeof singleton.initialize==="function"){
+ if(typeof singleton.initialize === "function"){
try{
singleton.initialize();
}catch(e){
Please sign in to comment.
Something went wrong with that request. Please try again.