-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.js
46 lines (43 loc) · 1.3 KB
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
(function(){
/**
Project:oop 4 js
Author: cava.zhang
Date: 2015-02-27 11:53:57
Email: admin@cavacn.com
*/
var Class = function(){}
Class.version = "0.0.5";
Class.author = "cava.zhang";
Class.email = "admin@cavacn.com";
Class.prototype.$ = function(){}
Class.extends = function(classname,obj){
var fn = function(){
if(!!arguments[0]&&this.$){
this.$.apply(this,arguments);
}else{
this.super("$",arguments);
}
}
fn.prototype = new this;
fn.classname = classname;
for(var key in obj){
fn.prototype[key] = obj[key];
}
fn.prototype.class = fn;
fn.prototype.__parent = this;
fn.prototype.super = function(){
var parent = this.__parent.prototype;
if(parent[arguments[0]]){
parent[arguments[0]].apply(this,arguments[1]);
}
// var array = Array.prototype.slice.call(arguments);
// var name = array.shift();
// if(parent[name]){
// parent[name].apply(this,array);
// }
}
fn.extends = this.extends;
return fn;
}
this.Class = Class;
}).call(this);