See be-overloading
<button be-functional='{
"click": {
"scriptRef": "my-script",
"fn": "yawnAndStretch"
}
}'>Tumble out of bed</button>
...
<script nomodule id=my-script be-exportable>
export const yawnAndStretch = e => {
e.target.textContent = 'Try to come to life';
}
</script>
- Do a git clone or a git fork of repository https://github.com/bahrus/be-functional
- Install node.js
- Run "npm install" from location of folder created in step 1.
- Run npm run serve. Open browser to http://localhost:3030/demo/
import 'be-functional/be-functional.js';
<script type=module crossorigin=anonymous>
import 'https://esm.run/be-functional';
</script>