Try Install Learn Blog API Packages GitHub
Pages

Using Providers

A Provider represents a source of asynchronous events. To subscribe to a Provider, you use it and pass it a record that contains the subscription data.

component Main {
  state counter : Number = 0

  use Provider.Tick {
    ticks: () : Promise(Void) {
      next { counter: counter + 1 }
    }
  }

  fun render : Html {
    <div>
      <{ Number.toString(counter) }>
    </div>
  }
}

In the above example we will update counter every second using the Tick Provider .

Other available Providers: