Skip to content

Commit 8e6f6e0

Browse files
committed
feat(device model component): add device model component to create model file
1 parent 124e0b5 commit 8e6f6e0

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

50 files changed

+15578
-176
lines changed

.gitignore

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
out
22
node_modules
3-
dist
4-
.vscode-test
3+
.vscode-test
4+
cache

assets/modelRepository/command.js

+43
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
const callbackStack = [];
2+
const vscode = acquireVsCodeApi();
3+
4+
function command(cmd, callback) {
5+
if (!cmd) {
6+
return;
7+
}
8+
let args = Array.from(arguments);
9+
if (typeof args[args.length - 1] === 'function') {
10+
callback = args[args.length - 1];
11+
args.length = args.length - 1;
12+
} else {
13+
callback = undefined;
14+
}
15+
args.shift();
16+
const messageId = new Date().getTime() + Math.random();
17+
18+
callbackStack.push({
19+
messageId,
20+
callback
21+
});
22+
23+
vscode.postMessage({
24+
messageId,
25+
command: cmd,
26+
parameter: args
27+
});
28+
}
29+
30+
window.addEventListener('message', event => {
31+
const message = event.data;
32+
33+
for (let index = 0; index < callbackStack.length; index++) {
34+
const callbackItem = callbackStack[index];
35+
if (callbackItem.messageId === message.messageId) {
36+
if (callbackItem.callback) {
37+
callbackItem.callback(message.payload);
38+
}
39+
callbackStack.splice(index, 1);
40+
break;
41+
}
42+
}
43+
});
+13
Loading
+13
Loading
Loading
Loading
+16
Loading

assets/modelRepository/image/Copy.svg

+6
Loading
+16
Loading
+18
Loading
+16
Loading
+12
Loading
+16
Loading

assets/modelRepository/image/Info.svg

+14
Loading

assets/modelRepository/image/More.svg

+13
Loading
+26
Loading
+12
Loading
Loading
Loading
+12
Loading
+13
Loading
+20
Loading
+16
Loading

0 commit comments

Comments
 (0)