Refactor scripts into ES6 modules

This commit is contained in:
Talia 2021-02-17 11:02:58 +01:00
parent bbbb23427a
commit c8fd5b1c40
2 changed files with 3 additions and 3 deletions

View File

@ -1,4 +1,4 @@
class BetterHTMLElement extends HTMLElement {
export class BetterHTMLElement extends HTMLElement {
attributeChangedCallback(name, old, value) { this[name+"Changed"](value, old) }
// Array of connected callbacks

View File

@ -1,4 +1,4 @@
function setup(root) {
const setup = (root) => {
root.parts = {}
root.querySelectorAll("[part-id]").forEach( element => {
root.parts[element.getAttribute("part-id")] = element
@ -7,7 +7,7 @@ function setup(root) {
return root
}
function template(strings, ...args) {
export const template = (strings, ...args) => {
let buf = []
for (i=0;i<strings.length;i++) {
buf.push(strings[i], args[i])