Browse Source

Merge pull request 'project web component' (#1) from bat-patch-1 into main

Reviewed-on: https://codeberg.org/macchiato/pages/pulls/1
file-group-page
bat 3 years ago
parent
commit
f9b77dd6e3
  1. 7
      app.js
  2. 2
      components/project.js
  3. 1
      sw.js

7
app.js

@ -1,3 +1,7 @@
import { Project } from "./components/project.js"
customElements.define('m-project', Project)
function e(tag, attrs, content) {
const el = document.createElement(tag)
el.innerText = content
@ -41,6 +45,9 @@ class Setup {
document.body.appendChild(
e('h1', {}, location.hash)
)
document.body.appendChild(
e('m-project', {}, '')
)
}
}
}

2
components/project.js

@ -1,4 +1,4 @@
class Project extends HTMLElement {
export class Project extends HTMLElement {
constructor() {
const shadow = this.attachShadow({mode: 'open'})
const textArea = document.createElement('textarea')

1
sw.js

@ -4,6 +4,7 @@ async function initCache() {
'/',
'/index.html',
'/app.js',
'/components/project.js',
])
}

Loading…
Cancel
Save