Add support for initialisation function to skooma

This commit is contained in:
Talia 2021-09-13 18:54:07 +02:00
parent 12edc1890e
commit 95c6540ba2
No known key found for this signature in database
GPG key ID: AD727AD22802D0D6

View file

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