GSI Object Oriented Online Offline (Go4) GO4-6.4.0
Loading...
Searching...
No Matches
core.mjs
Go to the documentation of this file.
1import { httpRequest, isStr } from 'jsroot';
2
3const _src = import.meta?.url;
4
5let source_dir = 'go4sys/';
6
7const version = '6.4.0';
8
9if (isStr(_src)) {
10 const pos = _src.indexOf('html5/core.mjs');
11 if (pos >= 0)
12 source_dir = _src.slice(0, pos);
13}
14
15const GO4 = { version, source_dir };
16
17console.log(`GO4 source_dir ${source_dir} version ${version}`);
18
19/** @summary Execute method for selected painter object
20 * @return {Promise} when done */
21function executeMethod(painter, method, options) {
22 let prefix = "";
23 if (painter.getItemName())
24 prefix = painter.getItemName() + "/"; // suppress / if item name is empty
25
26 let fullcom = prefix + "exe.json?method=" + method + (options || "&"); // send any arguments otherwise ROOT refuse to process it
27
28 return httpRequest(fullcom, 'text');
29}
30
31if (!globalThis.GO4)
32 globalThis.GO4 = GO4;
33else
34 console.warn('Global GO4 already configured!');
35
36export { source_dir, version, executeMethod, GO4 };