javascript-oop
Advanced tools
Comparing version 1.0.0 to 1.0.1
25
klass.js
(function() { | ||
var global = this, | ||
var global = (function(){ | ||
return this || (0, eval)('this'); | ||
}()), | ||
slice = Array.prototype.slice, | ||
@@ -210,3 +212,3 @@ enumerables = ['hasOwnProperty', 'valueOf', 'isPrototypeOf', 'propertyIsEnumerable', 'toLocaleString', 'toString', 'constructor'], | ||
return constructor; | ||
} | ||
}; | ||
@@ -234,3 +236,3 @@ var extend = function(newClass, newClassExtend) { | ||
newClass.extend(SuperClass); | ||
} | ||
}; | ||
@@ -296,17 +298,10 @@ | ||
if (typeof module === "object" && module && typeof module.exports === "object") { | ||
// 声明 Node module | ||
if (typeof module === 'object' && module && typeof module.exports === 'object') { | ||
module.exports = Klass; | ||
} else { | ||
// 声明 AMD / SeaJS module | ||
if (typeof define === "function" && (define.amd || seajs)) { | ||
define('klass', [], function() { | ||
return Klass; | ||
}); | ||
} | ||
} else if (typeof define === 'function') { | ||
define('klass', [], function() { return Klass; }); | ||
} | ||
if (typeof global === "object" && typeof global.document === "object") { | ||
if (typeof global === 'object' && typeof global.document === 'object') { | ||
global.Klass = Klass; | ||
} | ||
})(); | ||
}()); |
{ | ||
"name": "javascript-oop", | ||
"description": "JavaScript面向对象编程,类声明、继承……", | ||
"version": "1.0.0", | ||
"homepage": "https://github.com/mxjs/oop", | ||
"author": "Max Zhang <zhangdaiping@gmail.com>", | ||
"version": "1.0.1", | ||
"author": { | ||
"name": "Max Zhang", | ||
"email": "zhangdaiping@gmail.com", | ||
"url": "https://github.com/maxzhang" | ||
}, | ||
"respository": { | ||
"type": "git", | ||
"url": "https://github.com/maxzhang/oop.git" | ||
}, | ||
"keywords": [ | ||
@@ -13,10 +20,6 @@ "javascript", | ||
], | ||
"respository": { | ||
"type": "git", | ||
"url": "https://github.com/mxjs/oop.git" | ||
"bugs": { | ||
"url": "https://github.com/maxzhang/oop/issues" | ||
}, | ||
"main": "klass", | ||
"bugs": { | ||
"url": "https://github.com/mxjs/oop/issues" | ||
}, | ||
"engines": { | ||
@@ -23,0 +26,0 @@ "node": "*" |
@@ -1,7 +0,8 @@ | ||
JavaScript面向对象编程,类声明、继承…… | ||
=== | ||
javascript-oop | ||
============== | ||
> JavaScript面向对象编程,类声明、继承…… | ||
### 声明类 | ||
``` | ||
声明类 | ||
------ | ||
```js | ||
var MyCls = Klass.define({ | ||
@@ -25,4 +26,5 @@ constructor: function(name) { // 构造函数 | ||
### 继承类 | ||
``` | ||
继承类 | ||
------ | ||
```js | ||
var SubCls1 = Klass.define(MyCls, { | ||
@@ -39,4 +41,5 @@ method1: function() { // 重写父类方法 | ||
### 调用父类方法 | ||
``` | ||
调用父类方法 | ||
------------ | ||
```js | ||
var SubCls2 = Klass.define(MyCls, { | ||
@@ -61,5 +64,5 @@ method1: function() { | ||
### 静态属性/方法 | ||
``` | ||
声明静态属性和方法 | ||
----------------- | ||
```js | ||
var SubCls3 = Klass.define(MyCls, { | ||
@@ -79,7 +82,8 @@ statics: { // 静态属性和方法 | ||
```shell | ||
npm install javascript-oop --save-dev | ||
``` | ||
npm install javascript-oop | ||
``` | ||
``` | ||
在Node中调用: | ||
```js | ||
var Klass = require('javascript-oop'); | ||
@@ -86,0 +90,0 @@ var MyCls = Klass.define({ |
No website
QualityPackage does not have a website.
Found 1 instance in 1 package
13513
5
90
270
1