Add event listeners to skooma.js

This commit is contained in:
Talia 2021-05-26 11:26:44 +02:00
parent 9e475b4924
commit 578e965c90
Signed by: darkwiiplayer
GPG key ID: 7808674088232B3E

View file

@ -18,6 +18,9 @@ const parseArgs = (element, args) => {
parseArgs(element, arg)
else
for (let key in arg)
if (typeof arg[key] == "function")
element.addEventListener(key.replace(/^on[A-Z]/, x => x.charAt(x.length-1).toLowerCase()), arg[key])
else
element.setAttribute(key, parseAttribute(arg[key]))
}