bitty installation snippets examples documentation q&a

snippets

send and receive from the same element

  • A single element can contain both an data-s sending attribute and a data-r receiving attribute.
  • If the value of the attributes is the same, then the element will send the signal to itself.

html

<button 
  data-s="exampleSignal" 
  data-r="exampleSignal">0</button>

javascript

export const b = {};

export function exampleSignal(_, __, el) {
  el.innerHTML = el.innerHTMLAsInt() + 1;
}