forked from playcanvas/engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathdebug.js
More file actions
53 lines (46 loc) · 1.41 KB
/
debug.js
File metadata and controls
53 lines (46 loc) · 1.41 KB
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
/**
* @name pc.debug
* @private
* @namespace
*/
pc.debug = (function () {
var table = null;
var row = null;
var title = null;
var field = null;
return {
/**
* @name pc.debug.display
* @private
* @description Display an object and it's data in a table on the page
* @param {Object} data
*/
display: function (data) {
function init() {
table = document.createElement('table');
row = document.createElement('tr');
title = document.createElement('td');
field = document.createElement('td');
table.style.cssText = 'position:absolute;font-family:sans-serif;font-size:12px;color:#cccccc';
table.style.top = '0px';
table.style.left = '0px';
table.style.border = 'thin solid #cccccc';
document.body.appendChild(table);
}
if (!table) {
init();
}
table.innerHTML = '';
for (var key in data) {
var r = row.cloneNode();
var t = title.cloneNode();
var f = field.cloneNode();
t.textContent = key;
f.textContent = data[key];
r.appendChild(t);
r.appendChild(f);
table.appendChild(r);
}
}
};
}());