-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathprofiling.js
36 lines (33 loc) · 998 Bytes
/
profiling.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
import Alerts from './utils/alerts';
const fn = function () {
const alerts = new Alerts('#alerts');
/* global chrome */
chrome.storage.local.get('profilerStats', (stats) => {
if (chrome.runtime.lastError) {
alerts.failure('Can not get data: ' + chrome.runtime.lastError.message);
return;
}
const statsContainer = document.getElementById("profilerStats");
let pre = statsContainer.querySelector('pre');
if (pre) {
pre.remove();
}
pre = document.createElement("pre");
const code = document.createElement("code");
code.classList.add('language-json');
code.innerText = JSON.stringify(stats.profilerStats, null, 2);
pre.appendChild(code);
statsContainer.appendChild(pre);
/* global hljs */
hljs.configure({
tabReplace: ' ',
});
hljs.highlightBlock(code);
});
};
if (["complete", "interactive"].indexOf(document.readyState) > -1) {
fn();
}
else {
document.addEventListener("DOMContentLoaded", fn);
}