Whoops, forgot to remove that file
This commit is contained in:
parent
3b00a749b5
commit
6c6452c126
1 changed files with 0 additions and 45 deletions
|
|
@ -1,45 +0,0 @@
|
||||||
<script>
|
|
||||||
//load all of the scripts required to use uv/rh (this is not loaded by default due to the size)
|
|
||||||
//Usage: await window.loadProxyScripts or window.loadProxyScript.then(() => {})
|
|
||||||
window.loadProxyScripts = function() {
|
|
||||||
//wrap everything in a promise to avoid race conditions
|
|
||||||
return new Promise<void>((resolve) => {
|
|
||||||
//create and append then scripts tags to the body (this is how we lazy load things)
|
|
||||||
const epoxyScript = document.createElement('script');
|
|
||||||
epoxyScript.src = '/epoxy/index.js';
|
|
||||||
epoxyScript.defer = true;
|
|
||||||
document.body.appendChild(epoxyScript);
|
|
||||||
const uvBundle = document.createElement('script');
|
|
||||||
uvBundle.src = '/uv/uv.bundle.js';
|
|
||||||
uvBundle.defer = true;
|
|
||||||
document.body.appendChild(uvBundle);
|
|
||||||
const uvConfig = document.createElement('script');
|
|
||||||
uvConfig.src = '/uv/uv.config.js';
|
|
||||||
uvConfig.defer = true;
|
|
||||||
document.body.appendChild(uvConfig);
|
|
||||||
const bareMux = document.createElement('script');
|
|
||||||
bareMux.src = '/baremux/bare.cjs';
|
|
||||||
bareMux.defer = true;
|
|
||||||
document.body.appendChild(bareMux);
|
|
||||||
const checkScripts = setInterval(() => {
|
|
||||||
//If both of these aren't defined this will repeat until they are
|
|
||||||
//this allows use to wait for all of the scripts to be ready *before* we setup the serviceworker
|
|
||||||
if (typeof EpxMod !== 'undefined' && typeof BareMux !== 'undefined') {
|
|
||||||
clearInterval(checkScripts);
|
|
||||||
resolve();
|
|
||||||
}
|
|
||||||
}, 100);
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
//function to set a transport between the *defined* transports
|
|
||||||
//Usage: await window.setTransport("epoxy") or window.setTransport("epoxy").then(() => {})
|
|
||||||
window.setTransport = function(transport?: string) {
|
|
||||||
//wrap in a promise so we don't register sw until a transport is set.
|
|
||||||
return new Promise<void>((resolve) => {
|
|
||||||
const wispUrl = (location.protocol === "https:" ? "wss://" : "ws://") + location.host + "/wisp/";
|
|
||||||
BareMux.SetTransport("EpxMod.EpoxyClient", { wisp: wispUrl });
|
|
||||||
resolve();
|
|
||||||
});
|
|
||||||
}
|
|
||||||
</script>
|
|
||||||
Loading…
Add table
Reference in a new issue