Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- var W3 = new Object();
- W3.Registry = {
- _reg: [],
- set: function (id, value) {
- this._reg[id] = value;
- },
- get: function (id) {
- if (typeof(this._reg[id]) !== "undefined") {
- return this._reg[id];
- }
- },
- unset: function (id) {
- if (typeof(this._reg[id]) !== "undefined") {
- this._reg[id] = undefined;
- }
- },
- isset: function (id) {
- return (typeof(this._reg[id]) !== "undefined");
- }
- }
- W3.Custom = new Object();
- W3.Custom.Test = new Object();
- W3.Custom.Test.sayHi = function(val) {
- if(val) {
- alert("HI: " + val);
- } else {
- alert("HIII");
- }
- };
- var SomeObject = new Object();
- // __call();
- SomeObject.__noSuchMethod__ = function(method) {
- var a = method.replace('get', '');
- if (W3.Registry.isset(a)) {
- return W3.Registry.get(a);
- }
- }
- W3.Registry.set('Asd', W3.Custom.Test);
- SomeObject.getAsd().sayHi('Kizano was here :)');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement