We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 06e08b8 commit 96244faCopy full SHA for 96244fa
Proxy/virtual-proxy.ts
@@ -0,0 +1,39 @@
1
+interface Icon {
2
+ getIconWidth(): number;
3
+ getIconHeight(): number;
4
+ paintIcon(): void;
5
+}
6
+
7
+class ImageProxy implements Icon {
8
+ private realImage: Image;
9
+ private url: string;
10
11
+ constructor(url: string) {
12
+ this.url = url;
13
+ }
14
15
+ getIconWidth(): number {
16
+ if (this.realImage) {
17
+ return this.realImage.getIconWidth();
18
+ } else {
19
+ return 800;
20
21
22
23
+ getIconHeight(): number {
24
25
+ return this.realImage.getIconHeight();
26
27
+ return 600;
28
29
30
31
+ paintIcon(): void {
32
+ if (!this.realImage) {
33
+ this.realImage = new Image(this.url);
34
35
+ this.realImage.paintIcon();
36
37
38
39
+export {};
0 commit comments