KoryNunn / fastn-custom-elements

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

fastn-custom-elements

A test to see if fastn works natively with web-components/custom-elements

Result

It does!

Example

I used the webtorrent-element from https://github.com/mikeal/webtorrent-element in the example.

see it working

How

Literally all you need to do is import the web-component however you want:

<script src="https://cdn.jsdelivr.net/npm/webtorrent-element@latest/dist/webtorrent-element.min.js"></script>

and then in fastn:

fastn('my-web-component', {
    webComponentAttribute: fastn.binding('modelValue')
})

And it works with bound attributes and everything.

About


Languages

Language:JavaScript 100.0%Language:HTML 0.0%