4.5.1 • Published 6 years ago
@frontless/riot v4.5.1
frontless-riot
Riot.JS build with dependency injection for globals like document or Node.
Main purpose is to avoid concurent access to global variables when rendering components on the server side inside async functions or promises.
References
Cases when concurrent access happens on backend: 1. Concurrency in Node.JS 2. Async/Await Hell
For frontend guys : Wait don't touch that
Usage
npm i @frontless/riotimport * as riot from '@frontless/riot'
import {JSDOM} from 'jsdom'
import MyTag from 'mytag.riot'
riot.register('mytag', MyTag)
async render(){
const {document, Node} = new JSDOM().window;
const root1 = document.createElement('div')
document.body.appendChild(root1)
const result = riot.di({document, Node}).mount(root1, {}, 'random')
}