mirror of
https://github.com/falk-werner/webfuse
synced 2026-10-22 04:43:58 +00:00
add basic infrastructure of javascript example
This commit is contained in:
26
example/provider/javascript/js/startup.js
Normal file
26
example/provider/javascript/js/startup.js
Normal file
@@ -0,0 +1,26 @@
|
||||
|
||||
import { Webfuse } from "./webfuse/webfuse.js";
|
||||
import { StaticFileSystem } from "./static_filesystem.js";
|
||||
|
||||
let webfuse = null;
|
||||
const filesystem = new StaticFileSystem(new Map([
|
||||
["/foo", "foo"],
|
||||
["/bar", "foo"]
|
||||
]));
|
||||
|
||||
function onConnectButtonClicked() {
|
||||
if (webfuse) { webfuse.close(); }
|
||||
|
||||
const urlTextfield = document.querySelector('#url');
|
||||
const url = urlTextfield.value;
|
||||
console.log(url);
|
||||
|
||||
webfuse = new Webfuse(url, filesystem);
|
||||
}
|
||||
|
||||
function startup() {
|
||||
const connectButton = document.querySelector('#connect');
|
||||
connectButton.addEventListener('click', onConnectButtonClicked);
|
||||
}
|
||||
|
||||
document.addEventListener('DOMContentLoaded', startup(),false);
|
||||
Reference in New Issue
Block a user