forked from QuantStack/git2cpp
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.ts
More file actions
28 lines (24 loc) · 1022 Bytes
/
Copy pathindex.ts
File metadata and controls
28 lines (24 loc) · 1022 Bytes
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
import { ShellManager } from '@jupyterlite/cockle';
import "./style/deployment.css"
import { IDeployment } from './defs';
import { Deployment } from "./deployment";
document.addEventListener("DOMContentLoaded", async () => {
const baseUrl = window.location.href;
const shellManager = new ShellManager();
const browsingContextId = await shellManager.installServiceWorker(baseUrl);
const targetDiv: HTMLElement = document.getElementById('targetdiv')!;
const options: IDeployment.IOptions = {
baseUrl, browsingContextId, shellManager, targetDiv
}
// See if a local CORS proxy is available where we are expecting it by checking if it is there.
// This isn't good practice but is OK for local manual testing.
try {
const corsProxy = "http://localhost:8881/"
const response = await fetch(corsProxy);
if (response.ok && response.type == "cors") {
options.useLocalCors = corsProxy;
}
} catch (error) {}
const playground = new Deployment(options);
await playground.start();
})