-
Notifications
You must be signed in to change notification settings - Fork 71
/
Copy pathdemiwebgl2.js
82 lines (71 loc) · 2.45 KB
/
demiwebgl2.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
function main() {
id_0= document.body;
id_1 = document.createElement("canvas");
id_1.width = "320";
id_1.height = "240";
id_1.id = 1;
id_0.appendChild(id_1);
id_2016 = getWebGLContext(id_1);
webgl = id_2016;
for (var p in webgl) {
//console.log(p + " : " + typeof webgl[p]);
}
console.log(webgl.getSupportedExtensions());
console.log(getTagName(webgl));
getPropf(webgl,'prop', '');
getPropf(webgl,'func', '');
getPropf(webgl,'evt', '');
function getPropf(obj, type, propTypes) {
var items = [];
for (var p in obj) {
try {
if ((typeof obj[p] == 'function' || typeof obj[p] == 'object') && p.substr(0, 2) == 'on') {
if (type == 'evt' && !inArr(demicm.evtBlackList, p)) {
items.push(p);
}
} else if (typeof obj[p] == 'function') {
if (type == 'func' && !inArr(demicm.funcBlackList, p)) {
items.push(p);
}
} else if (p.indexOf('_') == -1) {
if (type == 'prop' && !inArr(demicm.propBlackList, p)) {
items.push(p);
if (propTypes) {
propTypes.push(typeof obj[p]);
}
}
}
} catch (e) {
console.log('// Error: getPropf: ' + e.message + obj);
}
}
return items;
}
function getTagName(elem) {
try {
if (!elem) {
return 'none';
} else if (String(elem) == '[object DocumentType]') {
return 'DocumentType';
// Special object
} else if (!elem.nodeName) {
if (elem.constructor) {
return elem.constructor.name;
} else {
return 'none';
}
} else {
var tag = elem.nodeName.toLowerCase().replace('#', '');
var colonIdx = tag.indexOf(':');
if (colonIdx != -1) {
tag = tag.slice(colonIdx + 1);
}
tag = tag.replace('-', '');
return tag;
}
}
catch (e) {
console.log('// Error: getTagName: ' + e.message);
}
}
}