blob: c62c0cf46eae13bc0568d9d3f63a3b08783f0b45 (
plain)
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
|
'use strict';
'require baseclass';
'require rpc';
const callSystemBoard = rpc.declare({
object: 'system',
method: 'board'
});
const callSystemInfo = rpc.declare({
object: 'system',
method: 'info'
});
return baseclass.extend({
info() {
const now = performance.now();
if (this.pending == null || now - this.asked > 1000) {
this.asked = now;
this.pending = L.resolveDefault(callSystemInfo(), {});
}
return this.pending;
},
// The board does not change while the page is open.
board() {
if (this.boardinfo == null)
this.boardinfo = callSystemBoard().catch(() => {
this.boardinfo = null;
return {};
});
return this.boardinfo;
}
});
|