Add support for initialisation function to skooma

This commit is contained in:
Talia 2021-09-13 18:54:07 +02:00
parent 4e67cba014
commit 6f99045d22
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -40,6 +40,8 @@ const parseArgs = (element, before, ...args) => {
for (let arg of args) for (let arg of args)
if (typeof arg == "string" || typeof arg == "number") if (typeof arg == "string" || typeof arg == "number")
element.insertBefore(document.createTextNode(arg), before) element.insertBefore(document.createTextNode(arg), before)
else if (typeof arg == "function")
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") else if (arg.constructor?.name === "Promise")