Remove promise handling from skooma.js

This was really just feature creep and doesn't have to be part of
skooma. It could easily be implemented as an independent function or
module.
This commit is contained in:
Talia 2022-04-06 00:40:37 +02:00
parent 4621790fbd
commit 64f28972c0
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -31,12 +31,6 @@ const parseAttribute = (attribute) => {
return JSON.stringify(attribute) return JSON.stringify(attribute)
} }
const createPromiseNode = promise => {
const comment = document.createComment(`Awaiting ${promise}`)
promise.then(result => {parseArgs(comment.parentNode, comment, result); comment.remove()})
return comment
}
const parseArgs = (element, before, ...args) => { const parseArgs = (element, before, ...args) => {
if (element.content) element = element.content if (element.content) element = element.content
for (let arg of args) if (arg !== empty) for (let arg of args) if (arg !== empty)
@ -48,8 +42,6 @@ const parseArgs = (element, before, ...args) => {
arg(element) arg(element)
else if ("nodeName" in arg) else if ("nodeName" in arg)
element.insertBefore(arg, before) element.insertBefore(arg, before)
else if (arg.constructor?.name === "Promise")
element.insertBefore(createPromiseNode(arg), before)
else if ("length" in arg) else if ("length" in arg)
parseArgs(element, before, ...arg) parseArgs(element, before, ...arg)
else else