API · Miscellaneous

riot.version

The current version number as String: '2.6.7'

riot.settings.brackets

A global Riot setting to customize the start and end tokens of the expressions. For example

riot.settings.brackets = '[% %]'

let’s you write expressions <p>[% like_this %]</p>. The start and end is separated with a space character.

riot.settings.asyncRenderTimeout

It allows you to change the riot.renderAsync timeout (default 1000ms)

riot.settings.asyncRenderTimeout = 2000 // ms

riot.util.tmpl.errorHandler

Utility hook function to catch all the errors swallowed by the riot template engine

riot.util.tmpl.errorHandler = function (err) {
  console.error(err.message + ' in ' + err.riotData.tagName) // your error logic here
}

riot.vdom

Expose the internal riot tags cache in order to query, debug, filter.. all the tags instances created

  riot.tag('foo', '<p>{ msg }</p>', function() {
    this.msg = 'hi'
  })
  riot.mount('foo')
  console.log(riot.vdom[0].msg) // 'hi'