forked from alibaba/lowcode-engine
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsimulator-host.ts
More file actions
56 lines (48 loc) · 1.05 KB
/
simulator-host.ts
File metadata and controls
56 lines (48 loc) · 1.05 KB
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
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
import {
BuiltinSimulatorHost,
} from '@alilc/lowcode-designer';
import { simulatorHostSymbol } from './symbols';
export default class SimulatorHost {
private readonly [simulatorHostSymbol]: BuiltinSimulatorHost;
constructor(simulator: BuiltinSimulatorHost) {
this[simulatorHostSymbol] = simulator;
}
static create(host: BuiltinSimulatorHost) {
if (!host) return null;
return new SimulatorHost(host);
}
/**
* 获取 contentWindow
*/
get contentWindow() {
return this[simulatorHostSymbol].contentWindow;
}
/**
* 获取 contentDocument
*/
get contentDocument() {
return this[simulatorHostSymbol].contentDocument;
}
/**
* 设置 host 配置值
* @param key
* @param value
*/
set(key: string, value: any) {
this[simulatorHostSymbol].set(key, value);
}
/**
* 获取 host 配置值
* @param key
* @returns
*/
get(key: string) {
return this[simulatorHostSymbol].get(key);
}
/**
* 刷新渲染画布
*/
rerender() {
this[simulatorHostSymbol].rerender();
}
}