@frontless/riot
v4.5.1
Published
Riot.JS with dependency injection
Downloads
7
Readme
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:
For frontend guys : Wait don't touch that
Usage
npm i @frontless/riot
import * 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')
}