Skip to content

Commit 0f09383

Browse files
committed
[http] adjust custom.htm tutorial
1 parent 6476468 commit 0f09383

File tree

1 file changed

+25
-30
lines changed

1 file changed

+25
-30
lines changed

tutorials/http/custom.htm

Lines changed: 25 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,8 @@
22
<html lang="en">
33
<head>
44
<meta charset="utf-8">
5-
65
<title>Custom HTML page for THttpServer</title>
76

8-
<script src="jsrootsys/scripts/JSRoot.core.js" type="text/javascript"></script>
9-
107
<style>
118
table, td {
129
border: 1px solid black;
@@ -50,38 +47,36 @@
5047
</tbody>
5148
</table>
5249

53-
<script type='text/javascript'>
50+
</body>
5451

55-
document.getElementById('btn_hpx').onclick = function() {
56-
JSROOT.httpRequest("hpx/root.json", 'object')
57-
.then(obj => JSROOT.redraw("draw_hpx", obj));
58-
}
52+
<script type='module'>
5953

60-
document.getElementById('btn_hpxpy').onclick = function() {
61-
JSROOT.httpRequest("hpxpy/root.json", 'object')
62-
.then(obj => JSROOT.redraw("draw_hpxpy", obj, "col"));
63-
}
54+
import { httpRequest, redraw, cleanup } from './jsrootsys/modules/main.mjs';
6455

65-
// here both objects requested with signle multi.json request
66-
document.getElementById('btn_both').onclick = function() {
67-
JSROOT.httpRequest("multi.json?number=2", "multi", "hpx/root.json\nhpxpy/root.json\n")
68-
.then(arr => {
69-
JSROOT.redraw("draw_hpx", arr[0]);
70-
JSROOT.redraw("draw_hpxpy", arr[1], "col");
71-
});
72-
}
56+
document.getElementById('btn_hpx').onclick = function() {
57+
httpRequest("hpx/root.json", 'object')
58+
.then(obj => redraw("draw_hpx", obj));
59+
}
7360

74-
document.getElementById('btn_clear').onclick = function() {
75-
if (JSROOT.cleanup) {
76-
JSROOT.cleanup("draw_hpx");
77-
JSROOT.cleanup("draw_hpxpy");
78-
} else {
79-
console.log('No drawing was perfromed - JSROOT.cleanup function not yet defined');
80-
}
81-
}
61+
document.getElementById('btn_hpxpy').onclick = function() {
62+
httpRequest("hpxpy/root.json", 'object')
63+
.then(obj => redraw("draw_hpxpy", obj, "col"));
64+
}
8265

83-
</script>
66+
// here both objects requested with signle multi.json request
67+
document.getElementById('btn_both').onclick = function() {
68+
httpRequest("multi.json?number=2", "multi", "hpx/root.json\nhpxpy/root.json\n")
69+
.then(arr => {
70+
redraw("draw_hpx", arr[0]);
71+
redraw("draw_hpxpy", arr[1], "col");
72+
});
73+
}
8474

85-
</body>
75+
document.getElementById('btn_clear').onclick = function() {
76+
cleanup("draw_hpx");
77+
cleanup("draw_hpxpy");
78+
}
79+
80+
</script>
8681

8782
</html>

0 commit comments

Comments
 (0)