forked from bitovi/documentjs
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathdocumentjs.js
76 lines (54 loc) · 1.42 KB
/
documentjs.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
//Lets define documentjs ... then get what we need
//We'll document this later
DocumentJS = function(){};
if(steal.overwrite){
load('steal/rhino/steal.js');
}else{
steal.send = steal;
}
steal( // '//steal/file/file',
'//steal/generate/ejs', //this is gone too now TODO FIX
'//documentjs/json',
'//documentjs/baseclass',
function($){
var extend = steal.extend;
extend(DocumentJS, steal)
DocumentJS.EJS = steal.EJS;
DocumentJS.JSONparse = JSONparse;
DocumentJS.toJSON = toJSON;
DocumentJS.Class.serialize = function(){
this.serializeable = DocumentJS.makeArray(arguments)
}
DocumentJS.Class.prototype.serialize = function(){
var ob = {}, serials = this.Class.serializeable;
for(var i=0; i < serials.length; i++){
var attr, asAttr;
if(typeof serials[i] == "object"){
attr = serials[i][0]
asAttr =serials[i][1]
}else{
attr = asAttr = serials[i]
}
if(this[attr] !== undefined){
ob[asAttr] = (typeof this[attr] == 'function' ? this[attr]() : this[attr] )
//print(typeof ob[serials[i]])
}
}
return ob;
}
delete JSONparse;
delete toJSON;
},
'//documentjs/distance',
'//documentjs/application',
'//documentjs/pair' ,
'//documentjs/directives',
'//documentjs/function',
'//documentjs/class',
'//documentjs/constructor',
'//documentjs/file',
'//documentjs/add',
'//documentjs/static',
'//documentjs/prototype',
'//documentjs/attribute',
'//documentjs/page')