bitty installation snippets examples documentation q&a

snippets

run an init function

  • An init key can be added to the top level export const b object to trigger an initialization function that runs as soon as bitty is ready without requiring other interaction.

html

<div data-r="snippet"></div>

javascript

export const b = { init: "snippet" };

export function snippet(_, __, el) {
  el.innerHTML = "initialized from b.init";
}