JSPM

  • Created
  • Published
  • Downloads 13
  • Score
    100M100P100Q49328F
  • License BSD-2-Clause

Create web components that run in a Web Worker

Package Exports

  • fritz
  • fritz/window

Readme

fritz

A library for rendering custom elements in a web worker.

worker.js

import { Component, h } from 'fritz';

class Hello extends Component {
  static get props() {
    return {
      name: { attribute: true }
    }
  }

  render({name}) {
    return (
      <span>Hello {name}</span>
    );
  }
}

fritz.define('x-hello', Hello);

index.html

<!doctype html>
<html lang="en">
<title>My App</title>

<x-hello name="world"></x-hello>

<script type="module">
  import fritz from '//unpkg.com/fritz@next/window.js';

  fritz.use(new Worker('./worker.js'));
</script>

Install

Using Yarn:

yarn add fritz

Using npm:

npm install fritz

License

BSD 2 Clause