How to use the riot.Tag function in riot

To help you get started, we’ve selected a few riot examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github ilearnio / riot-ssr / index.js View on Github external
function createTag (tagPath, opts, onReady) {
  if (onReady) {
    //
    // Extend `riot.Tag.prototype` first, so that it would
    // contain required `asyncStart` and `asyncEnd`
    //

    riot.Tag.prototype.asyncStart = function () {
      var root = getRootTag(this)

      // Use the root tag as the storage, which will be set
      // up once when `asyncStart` will be called for the
      // first time
      root.ssr || (root.ssr = {
        asyncCounter: 0,
        onReadyStack: [onReady],
        ready: false
      })

      if (root.ssr.ready) {
        throw new Error('Calling `tag.asyncStart()` after rendered result ' +
          'was already returned')
      }
github ilearnio / riot-ssr / index.js View on Github external
function getRootTag (tag) {
  while (tag.parent || tag.opts.parent instanceof riot.Tag) {
    tag = tag.parent || tag.opts.parent
  }

  return tag
}
github leekangtaqi / ninjajs / src / application.js View on Github external
}
	get mode(){
		return this._mode;
	}
	get entry(){
		return this._entry;
	}
	get env(){
		return this._env;
	}
}

const appCreator = params => new Ninja(params)
const uiLib = riot

appCreator.Component = riot.Tag

export default appCreator
export { connect, provider, uiLib }
github leekangtaqi / ninjajs / src / ninja-redux / components / provider.js View on Github external
return function(entry) {
		invariant((typeof entry === 'object' && entry instanceof riot.Tag), `
			provider expect a tag instead of ${entry}`);
		entry.opts.store = store;
		provider = entry;
		return provider;
	}
}