Skip to content

Latest commit

 

History

History
41 lines (33 loc) · 798 Bytes

example-01.md

File metadata and controls

41 lines (33 loc) · 798 Bytes
<!-- index.html -->

<html lang="en">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>Front-end</title>
  <script type="importmap">
    {
      "imports": {
        "@brtmvdl/frontend": "https://cdn.jsdelivr.net/npm/@brtmvdl/[email protected]/src/index.js"
      }
    }
  </script>
</head>

<body>
  <div id="app"></div>
  <script type="module" src="./index.js"></script>
</body>
</html>
// index.js

import { HTML, nInput, nButton } from '@brtmvdl/frontend'

const app = HTML.fromId('app')

const input = new nInput()
input.setPlaceholder('input')
app.append(input)

const button = new nButton()
button.setText('button')
button.on('click', () => window.alert(`value: ${input.getValue()}`))
app.append(button)