{"maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"dist-tags":{"latest":"0.2.0-beta.1"},"author":{"name":"Exodia","email":"d_xinxin@163.com"},"description":"A powerful Javascript Class Factory (Object oriented)","readme":"eoo\n==\n\nBase library for OO style programming, supports both browser and node\n\n## Usage\n\n### inherits Class\n\nTop Class is the ***Class***\n\n```javascript\n// var Class = require('oo')\nrequire(['oo'], function(Class) {\n\n    // a base class\n    var Super = Class({\n        // constructor will be called on instantiation\n         constructor: function() {\n\n         },\n         // members that will be added to the prototype\n         say: function(content) {\n             console.log(content)\n         }\n    });\n\n    // inherits the Super\n    var Sub = Class(Super, {\n        constructor: function(prop) {\n        //  $super method will call the Super Class's method with the same name,\n        // in this, is `constructor`\n            this.$super(arguments);\n\n            // other code\n            this.prop = prop;\n        },\n\n        say: function(content) {\n            this.$super(arguments);\n            console.log(this.prop)\n        }\n    });\n\n    var sup = new Super();\n    sup.say('hi');\n\n    var sub = new Sub('sub');\n    sub.say('fuck!');\n});\n```\n\n### inherits Object\n\nThis equals ```Object.create``` method.\n\n```javascript\nClass.static(obj);\n```\n\n## attribute\n\n### Class#constructor\nif config a constructor, and it is a function, it will be called on instantiation\n\n### Class#$super\n$super method will call the Super Class's method with the same name;\n\n***notice:***\nbecause `$super` internal implementation uses the `arguments.caller`, $super can not be used in strict mode!\n\n###  Class#$self\nthis property references the instance's Class:\n\n```javascript\nvar Base = Class();\nvar instance = new Base();\ninstance.$self === Base // true\n```\n\n### Class.$superClass\nreferences the super class:\n\n```javascript\nvar Super = Class();\nvar Sub = Class(Super);\n\nSub.$superClass === Super // true\n```\n\n### Class.create\nalias of Class\n\n### Class.static\ncreates a new object with the specified prototype object and properties.\nJust equals ```Object.create``` method.\n\n### Class.defineAccessor\nquickly generator the accessor for the object;\n\n ```javascript\n Class.defineAccessor(obj, 'name');\n typeof obj.setName === 'function'; // true\n typeof obj.getName === 'function'; // true\n ```\n\n### Class.defineMembers\nAdd properties to the function prototype so we can create a sub class first, and then add members to the sub class.\nThis will enable the function in the added members to use ```this.$super()``` feature;\n\n```javascript\nvar Super = Class({\n    method: function () {\n        console.log('super method!');\n    }\n});\nvar Sub = Class(Super);\noo.defineMembers(Sub, {\n    method: function () {\n        this.$super(arguments);\n        console.log('sub method');\n    }\n});\n\nvar instance = new Sub();\ninstance.method(); // 'super method'; 'sub method';\n\n```\n\n\n### Class.createPrivate\ncreate a private object whose prototype points the first param if has,\nand return a token function which accept an object as param,\ncall the token function with an object, it will return the private part of the object,\nbecause the private part is just a object, you can do any operation on it.\nDo not expose the token function to the outside.\n\n```javascript\n// MyClass.js\n// $private is a secret token function, and used in the module scope.\nvar $private = Class.createPrivate({\n    // this method is on the prototype shared by all instance passed from the $private function\n    privatePrototypeMethod: function () {\n        return this.getPrivateProp();\n    }\n});\n\nvar MyClass = Class({\n    constructor: function () {\n        $private(this).privateProp = 'privateProp';\n    },\n    getPrivateProp: function () {\n        return $private(this).privateProp;\n    },\n    callPrivateMethod: function () {\n        $private(this).privatePrototypeMethod.call(this);\n    }\n});\n\nvar my = new MyClass();\nalert(my.getPrivateProp()); // 'privateProp'\nalert(my.callPrivateMethod()); // 'privateProp'\n\n```\n\n### Class.defineProtect\ndefine a privateToken created by Class.createPrivate as the protectToken of the class\n\n```javascript\nvar $protect = Class.createPrivate({\n    protectMethod: function () {\n        console.log('call Super protectMethod');\n    },\n    method: function () {\n        console.log('call method');\n    }\n    });\n\nvar Super = Class({\n    callProtectMethod: function () {\n        return $protect(this).protectMethod();\n    },\n    $protect: $protect // config sugar, eoo will call Class.defineProtect internal;\n});\n\nvar $subProtect = Class.createPrivate({\n    protectMethod: function () {\n        console.log('call Sub protectMethod');\n        // call super class protect method from $super keyword;\n        $subProtect(this).$super.protectMethod();\n    }\n});\nvar Sub = Class(Super, {\n    invoke: function () {\n        $subProtect(this).method();\n        $subProtect(this).protectMethod();\n    }\n});\n\nClass.defineProtect(Sub, $subProtect);\n\nvar s = new Sub();\n\n// 'call method'\n// 'call Sub protectMethod'\n// 'call Super protectMethod'\ns.invoke();\n\n```\n\n\n","repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"bugs":{"url":"https://github.com/ecomfe/oo/issues"},"license":"MIT","versions":{"0.0.3":{"name":"eoo","version":"0.0.3","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.3","dist":{"shasum":"71cde617d42d4400a073fe6db17c622f2f60fa43","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.3.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"directories":{}},"0.0.4":{"name":"eoo","version":"0.0.4","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.4","dist":{"shasum":"81d384441823d8d728d1711bf381096bd67254c7","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.4.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"directories":{}},"0.0.5":{"name":"eoo","version":"0.0.5","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.5","dist":{"shasum":"a38ea3ca1b48b25efcc376c84f5897aab8299ca3","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.5.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"directories":{}},"0.0.6":{"name":"eoo","version":"0.0.6","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.6","dist":{"shasum":"c023ba863577b943eab0b10e5a469fdcef3c4859","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.6.tgz"},"_from":".","_npmVersion":"1.3.25","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"directories":{}},"0.0.7":{"name":"eoo","version":"0.0.7","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.7","_shasum":"8bfc845f89f3512fec3e8b766258c6fd62efe201","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"8bfc845f89f3512fec3e8b766258c6fd62efe201","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.7.tgz"},"directories":{}},"0.0.8":{"name":"eoo","version":"0.0.8","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.8","_shasum":"91d84a15e8cd734784ee7a70c0574dcf6da4af94","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"91d84a15e8cd734784ee7a70c0574dcf6da4af94","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.8.tgz"},"directories":{}},"0.0.9":{"name":"eoo","version":"0.0.9","description":"A powerful Javascript Class Factory (Object oriented)","main":"oo.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","_id":"eoo@0.0.9","_shasum":"e3e619da8806fd1dfb817bc58d485690052f6e95","_from":".","_npmVersion":"1.4.9","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"e3e619da8806fd1dfb817bc58d485690052f6e95","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.0.9.tgz"},"directories":{}},"0.1.0":{"name":"eoo","version":"0.1.0","description":"A powerful Javascript Class Factory (Object oriented)","main":"main.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"scripts":{"test":"cd test && karma start --singleRun"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","devDependencies":{"karma":"^0.12.23","karma-chrome-launcher":"^0.1.4","karma-coverage":"^0.2.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.2.2","karma-phantomjs-launcher":"^0.1.4"},"dependencies":{"requirejs":"^2.1.15"},"gitHead":"fd3eca4fdd2082622a860faf2efa30d948e29a1e","_id":"eoo@0.1.0","_shasum":"55ea7bfb04695b4280ba8bdb7c269b4491d53a5a","_from":".","_npmVersion":"2.0.1","_nodeVersion":"0.10.28","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"55ea7bfb04695b4280ba8bdb7c269b4491d53a5a","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.1.0.tgz"},"directories":{}},"0.1.1":{"name":"eoo","version":"0.1.1","description":"A powerful Javascript Class Factory (Object oriented)","main":"main.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"scripts":{"test":"cd test && karma start --singleRun"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","devDependencies":{"karma":"^0.12.23","karma-chrome-launcher":"^0.1.4","karma-coverage":"^0.2.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.2.2","karma-phantomjs-launcher":"^0.1.4"},"gitHead":"e8fe85434119db6c5e08058bf56bb31fc4582122","_id":"eoo@0.1.1","_shasum":"841a014865ca550daea6ab3696a1215046b6db98","_from":".","_npmVersion":"2.0.1","_nodeVersion":"0.10.28","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"841a014865ca550daea6ab3696a1215046b6db98","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.1.1.tgz"},"directories":{}},"0.1.3":{"name":"eoo","version":"0.1.3","description":"A powerful Javascript Class Factory (Object oriented)","main":"src/main.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"scripts":{"test":"cd test && karma start --singleRun"},"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"GPL","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"homepage":"https://github.com/ecomfe/oo","devDependencies":{"karma":"^0.12.23","karma-chrome-launcher":"^0.1.4","karma-coverage":"^0.2.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.2.2","karma-phantomjs-launcher":"^0.1.4"},"edp":{"wwwroot":"/","depDir":"dep","srcDir":"src","main":"main","loaderAutoConfig":"js,htm,html,tpl,vm,phtml","loaderUrl":"http://s1.bdstatic.com/r/www/cache/ecom/esl/1-8-2/esl.js","dependencies":{}},"gitHead":"eefcb6eab959d5ade0280a694475663ab1853719","_id":"eoo@0.1.3","_shasum":"ed16b1d5a4c631ed390f210e45f9e8c2376d28c3","_from":".","_npmVersion":"2.5.1","_nodeVersion":"0.11.16","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"ed16b1d5a4c631ed390f210e45f9e8c2376d28c3","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.1.3.tgz"},"directories":{}},"0.2.0-beta.1":{"name":"eoo","version":"0.2.0-beta.1","description":"A powerful Javascript Class Factory (Object oriented)","main":"src/main.js","maintainers":[{"name":"exodia","email":"d_xinxin@163.com"}],"repository":{"type":"git","url":"git://github.com/ecomfe/oo.git"},"scripts":{"start":"cd test && karma start --debug","test":"cd test && karma start --singleRun"},"contributors":[{"name":"xiaoxin0818","url":"https://github.com/xiaoxin0818"},{"name":"yanghuabei","url":"https://github.com/yanghuabei"}],"keywords":["class","Class","Constructor","prototype","inheritance","class","inheritance"],"author":{"name":"Exodia","email":"d_xinxin@163.com"},"license":"MIT","bugs":{"url":"https://github.com/ecomfe/oo/issues"},"files":["src","README.md"],"homepage":"https://github.com/ecomfe/oo","devDependencies":{"jasmine-core":"^2.3.4","karma":"^0.12.23","karma-chrome-launcher":"^0.1.4","karma-coverage":"^0.2.4","karma-ie-launcher":"^0.1.5","karma-jasmine":"^0.3.6","karma-phantomjs-launcher":"^0.1.4","karma-requirejs":"^1.0.0","requirejs":"^2.2.0"},"edp":{"wwwroot":"/","depDir":"dep","srcDir":"src","main":"main","loaderAutoConfig":"js,htm,html,tpl,vm,phtml","loaderUrl":"http://s1.bdstatic.com/r/www/cache/ecom/esl/1-8-2/esl.js","dependencies":{}},"gitHead":"96e8eed514647571148ae812dff38a7b09b4dab9","_id":"eoo@0.2.0-beta.1","_shasum":"0a40ce894b56d0fe5d3b1017aa89e823161e82f4","_from":".","_npmVersion":"3.9.3","_nodeVersion":"6.2.1","_npmUser":{"name":"exodia","email":"d_xinxin@163.com"},"dist":{"shasum":"0a40ce894b56d0fe5d3b1017aa89e823161e82f4","tarball":"http://nexus.dui88.com:8081/nexus/content/groups/npm-all/eoo/-/eoo-0.2.0-beta.1.tgz"},"_npmOperationalInternal":{"host":"packages-16-east.internal.npmjs.com","tmp":"tmp/eoo-0.2.0-beta.1.tgz_1468776796799_0.44768300419673324"},"directories":{}}},"name":"eoo","contributors":[{"name":"xiaoxin0818","url":"https://github.com/xiaoxin0818"},{"name":"yanghuabei","url":"https://github.com/yanghuabei"}],"time":{"modified":"2016-07-17T17:33:18.838Z","created":"2014-05-15T03:54:55.912Z","0.0.1":"2014-05-15T03:54:55.912Z","0.0.2":"2014-05-19T06:15:05.451Z","0.0.3":"2014-05-19T07:33:18.049Z","0.0.4":"2014-05-19T15:58:44.998Z","0.0.5":"2014-05-22T08:03:54.929Z","0.0.6":"2014-05-24T02:05:22.534Z","0.0.7":"2014-07-17T06:37:16.578Z","0.0.8":"2014-07-18T07:57:49.287Z","0.0.9":"2014-09-13T09:25:23.162Z","0.1.0":"2014-09-26T08:38:32.815Z","0.1.1":"2014-09-26T08:44:55.893Z","0.1.3":"2015-05-11T08:03:46.826Z","0.2.0-beta.1":"2016-07-17T17:33:18.838Z"},"readmeFilename":"README.md","homepage":"https://github.com/ecomfe/oo"}