|
1 | 1 | import { field, logger, time } from "@coder/logger";
|
2 |
| -const loadTime = time(2500); |
3 |
| - |
4 | 2 | import { Client, IURI, setUriFactory } from "@coder/ide";
|
5 | 3 | import { URI } from "vs/base/common/uri";
|
6 | 4 | import "./firefox";
|
7 | 5 |
|
8 |
| -setUriFactory({ |
9 |
| - // TODO: not sure why this is an error. |
10 |
| - // tslint:disable-next-line no-any |
11 |
| - create: <URI>(uri: IURI): URI => URI.from(uri) as any, |
12 |
| - file: (path: string): IURI => URI.file(path), |
13 |
| - parse: (raw: string): IURI => URI.parse(raw), |
14 |
| -}); |
| 6 | +const load = (): Promise<void> => { |
| 7 | + return new Promise((resolve, reject) => { |
| 8 | + setUriFactory({ |
| 9 | + // TODO: not sure why this is an error. |
| 10 | + // tslint:disable-next-line no-any |
| 11 | + create: <URI>(uri: IURI): URI => URI.from(uri) as any, |
| 12 | + file: (path: string): IURI => URI.file(path), |
| 13 | + parse: (raw: string): IURI => URI.parse(raw), |
| 14 | + }); |
| 15 | + |
| 16 | + reject(new Error("not finished")); |
15 | 17 |
|
16 |
| -// export const client = new Client({ |
17 |
| -// mkDirs: [ |
18 |
| -// "~/vscode/extensions", |
19 |
| -// "~/.config/User", |
20 |
| -// ], |
21 |
| -// }); |
| 18 | + // export const client = new Client({ |
| 19 | + // mkDirs: [ |
| 20 | + // "~/vscode/extensions", |
| 21 | + // "~/.config/User", |
| 22 | + // ], |
| 23 | + // }); |
22 | 24 |
|
23 |
| -// const overlayElement = document.getElementById("overlay"); |
24 |
| -// const msgElement = overlayElement |
25 |
| -// ? overlayElement.querySelector(".message") as HTMLElement |
26 |
| -// : undefined; |
| 25 | + // const importTime = time(1500); |
| 26 | + // import(/* webpackPrefetch: true */ "./workbench").then((module) => { |
| 27 | + // logger.info("Loaded workbench bundle", field("duration", importTime)); |
| 28 | + // const initTime = time(1500); |
27 | 29 |
|
28 |
| -// const importTime = time(1500); |
29 |
| -// import(/* webpackPrefetch: true */ "./workbench").then((module) => { |
30 |
| -// logger.info("Loaded workbench bundle", field("duration", importTime)); |
31 |
| -// const initTime = time(1500); |
| 30 | + // return module.initialize(client).then(() => { |
| 31 | + // logger.info("Initialized workbench", field("duration", initTime)); |
| 32 | + // |
| 33 | + // }); |
| 34 | + // }).catch((error) => { |
| 35 | + // }); |
| 36 | + }); |
| 37 | +}; |
32 | 38 |
|
33 |
| -// return module.initialize(client).then(() => { |
34 |
| -// logger.info("Initialized workbench", field("duration", initTime)); |
35 |
| -// logger.info("Load completed", field("duration", loadTime)); |
36 |
| -// if (overlayElement) { |
37 |
| -// overlayElement.style.opacity = "0"; |
38 |
| -// overlayElement.addEventListener("transitionend", () => { |
39 |
| -// overlayElement.remove(); |
40 |
| -// }); |
41 |
| -// } |
42 |
| -// }); |
43 |
| -// }).catch((error) => { |
44 |
| -// logger.error(error); |
45 |
| -// if (overlayElement) { |
46 |
| -// overlayElement.classList.add("error"); |
47 |
| -// } |
48 |
| -// if (msgElement) { |
49 |
| -// msgElement.innerText = `Failed to load: ${error.message}. Retrying in 3 seconds...`; |
50 |
| -// } |
51 |
| -// setTimeout(() => { |
52 |
| -// location.reload(); |
53 |
| -// }, 3000); |
54 |
| -// }); |
| 39 | +export { load }; |
0 commit comments