1.0.2 • Published 6 years ago

riot-vigilante v1.0.2

Weekly downloads
2
License
MIT
Repository
github
Last release
6 years ago

Vigilante

Description

Store all your observables in one place. Vigilante consists only of one function, vigilante.observe(keyword), that is used to get an observable from the store.

For instructions, see the short example below or a full example here.

Get it

yarn add vigilante

Example

app.tag

<app>
  <counter />
  <push-button />

  <script>
    import { observe } from 'vigilante';
  </script>
</app>

counter.tag

<counter>
  <h3>Times clicked: { count }</h3>
  <push-button />

  <script>
    this.count = 0;
    const counter = this;
    
    observe('clicker').on('click', () => {
      counter.count += 1;
      counter.update();
    });
  </script>
</counter>

push-button.tag

<push-button>
  <button onclick={ click }>Click me!</button>

  <script>
    click() {
      observe('clicker').trigger('click');
    }
  </script>
</push-button>