feat: basic use of custom components

This commit is contained in:
Vlad Stan
2022-08-03 13:50:07 +03:00
parent f102928812
commit b96bdf25f6
5 changed files with 1231 additions and 1174 deletions
@@ -139,3 +139,23 @@ const readFromSerialPort = serial => {
}
return readStringUntil
}
function loadTemplateAsync(path) {
const result = new Promise(resolve => {
const xhttp = new XMLHttpRequest()
console.log('### 300')
xhttp.onreadystatechange = function () {
if (this.readyState == 4) {
if (this.status == 200) resolve(this.responseText)
if (this.status == 404) resolve('Page not found.')
}
}
xhttp.open('GET', path, true)
xhttp.send()
})
return result
}