class Finder{ appId = "finder" constructor(){ // this.appElem = appElem } /** * @param {string} path */ NewWindow(path){ // console.log("Init") fetch(`${window.location.origin}/application/${this.appId}/render`) //TODO Move to wde func. Or Not? .then((response) => response.text()) .then((html) => { let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 500, 350 ) newWindow.innerHTML = html // console.log(newWindow.children[1].children[0]) let fileView = new FileView("/kek", newWindow.children[1].children[0], this.click) let scrollBar = new WdeScrollBar(newWindow.children[1].children[1], newWindow.children[1].children[0]) let closeButton = newWindow.children[0].children[0] closeButton.addEventListener('click', function (params) { WebDesktopEnvironment.CloseWindow(newWindow) }) }) .catch((error) => { WebDesktopEnvironment.Alert(error); }) } /** * @param {MouseEvent} event * @param {string} path */ click(event, path){ let fileName = event.target.getAttribute("fileName") let fileExtension = fileName.split(".")[fileName.split(".").length - 1] switch (fileExtension) { case "lol": WebDesktopEnvironment.Open("finder", ["pizda"]) break; default: console.log("Unsupported file type") break; } } }