Plugins

Riot provides an easy way to upgrade its components. When a component is created it can be enhanced by the plugins registered via riot.install.

  1. // riot-observable.js
  2. let id = 0
  3. riot.install(function(component) {
  4. // all components will pass through here
  5. component.uid = id++
  6. })
  1. <!-- my-component.riot -->
  2. <my-component>
  3. <h1>{ uid }</h1>
  4. </my-component>