mirror of
https://github.com/kiddin9/op-packages.git
synced 2026-11-05 18:44:03 +08:00
🛸 Sync 2026-09-22 19:25:09
This commit is contained in:
1 parent
8197f31b41
commit
402920f93d
19 files changed
+1022
-139
No files matched your search
@@ -0,0 +1,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;
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user