-
Notifications
You must be signed in to change notification settings - Fork 0
/
bmbench.js_browser.js
72 lines (56 loc) · 1.59 KB
/
bmbench.js_browser.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
//
// bmbench.js_browser.js
//
/* globals gState, startBench */
"use strict";
function setDisabled(id, disabled) {
var element = window.document.getElementById(id);
element.disabled = disabled;
}
function fnLog(s) {
gState.outputArea.value += s + "\n";
if (typeof console !== "undefined") { // special care for IE
console.log(s); // eslint-disable-line no-console
}
}
function fnDone() {
if (typeof console !== "undefined") { // special care for IE
console.log("DEBUG: benchmark done"); // eslint-disable-line no-console
}
setDisabled("startButton", false);
setDisabled("stopButton", true);
setDisabled("clearButton", false);
}
function onStartButtonClick(frm) { // eslint-disable-line no-unused-vars
var options = {
bench1: Number(frm.bench1.value),
bench2: Number(frm.bench2.value),
n: Number(frm.n.value),
outputArea: frm.outputArea,
bWantStop: false,
fnLog: fnLog,
fnDone: fnDone
};
//frm.outputArea.value = "";
setDisabled("startButton", true);
setDisabled("stopButton", false);
setDisabled("clearButton", true);
return startBench(options);
}
function onStopButtonClick(frm) { // eslint-disable-line no-unused-vars
gState.bWantStop = true;
setDisabled("stopButton", true);
}
function onClearButtonClick(frm) { // eslint-disable-line no-unused-vars
frm.outputArea.value = "";
setDisabled("clearButton", true);
}
function onLoad() {
if (typeof console !== "undefined") { // special care for IE
console.log("DEBUG: onLoad"); // eslint-disable-line no-console
}
setDisabled("stopButton", true);
setDisabled("clearButton", true);
}
window.onload = onLoad;
// end