personal-website/resources/sys/personal-properties/personal-properties.js
2023-05-16 02:04:16 +03:00

36 lines
1.1 KiB
JavaScript

class AboutMe{
appId = "AboutMe"
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
this.appElem = appElem
}
/**
* @param {string} chroot
* @param {[]string} args
*/
async NewWindow(chroot, args){
console.log(chroot)
if (chroot == ""){
chroot = "/Applications" //FIXME
}
const params = new URLSearchParams({isMobile: WebDesktopEnvironment.isMobile, path: `${chroot}/AboutMe.app/aboutme.props`})
const response = await fetch(`/app/${this.appId}/render?`+ params)
if (response.status != 200){
WebDesktopEnvironment.Alert("Error TODO") //TODO
return
}
const html = await response.text()
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html
newWindow.style.height = 'auto'
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
WebDesktopEnvironment.CloseWindow(newWindow)
})
}
}