personal-website/res/dev-fs/apps/AboutMe/AboutMe.js

37 lines
1.0 KiB
JavaScript
Raw Normal View History

2023-05-09 03:17:34 +00:00
class AboutMe{
2023-05-17 13:57:55 +00:00
static appID = "AboutMe"
2023-03-17 01:16:51 +00:00
/**
* @param {HTMLElement} appElem
*/
constructor(appElem){
2023-03-18 00:34:56 +00:00
this.appElem = appElem
2023-03-17 01:16:51 +00:00
}
2023-04-12 17:04:25 +00:00
/**
2023-05-17 13:57:55 +00:00
* @param {[]string} args
* @param {Object} runContext
2023-04-12 17:04:25 +00:00
*/
2023-05-17 13:57:55 +00:00
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)
2023-05-17 13:57:55 +00:00
})
2023-05-10 23:17:59 +00:00
if (response.status != 200){
WebDesktopEnvironment.Alert("Error TODO") //TODO
return
}
const html = await response.text()
2023-05-07 19:56:40 +00:00
2023-05-10 23:17:59 +00:00
let newWindow = WebDesktopEnvironment.CreateNewWindow(this.appId, 360, document.body.clientHeight*0.8 )
newWindow.innerHTML = html
newWindow.style.height = 'auto'
2023-03-20 11:20:37 +00:00
2023-06-06 22:49:26 +00:00
newWindow.querySelector("#closeWindowButton").addEventListener('click', () => {
2023-05-10 23:17:59 +00:00
WebDesktopEnvironment.CloseWindow(newWindow)
2023-03-17 01:16:51 +00:00
})
}
2023-04-13 01:09:07 +00:00
}