37 lines
1.1 KiB
JavaScript
37 lines
1.1 KiB
JavaScript
class AboutMe{
|
|
static appID = "AboutMe"
|
|
/**
|
|
* @param {HTMLElement} appElem
|
|
*/
|
|
constructor(appElem){
|
|
this.appElem = appElem
|
|
}
|
|
|
|
/**
|
|
* @param {[]string} args
|
|
* @param {Object} runContext
|
|
*/
|
|
async NewWindow(args, runContext){
|
|
const params = new URLSearchParams({
|
|
path: `:/aboutme.props`,
|
|
})
|
|
const response = await fetch(`/app/${AboutMe.appID}/render?`+ params,{
|
|
method: "POST",
|
|
body: JSON.stringify(runContext)
|
|
})
|
|
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)
|
|
})
|
|
}
|
|
} |