lr-client-renderer
v1.0.1
Published
Client side renderer extension for lagoon-road
Downloads
11
Maintainers
Readme
lr-client-renderer reference
A Lagoon road extension that gives you renderer functionality on the client. This renderer does quick replacement and doesn't do virtual dom html difference changes. It should suffice for about 95% of all cases. When you start working more with a websocket pub/sub system you might want to consider writing your own renderer or use a virtual dom approach so user input will not get replaced on dom updates. Read more about writing extensions in the guide.
The client side renderer sends out update events whenever a component has been added to the DOM. See the guide to understand how to implement this.
| Information | - | | ----------- | - | | Code coverage | - | | Repo link | lr-client-renderer | | Dependencies | - | | Size (Browserify, Babel and Gzip)| 851 bytes | | Version | 1.0.0 | | License | MIT | | Usage | guide |
Adding the extension to lagoon road
const router = require('lr-client-renderer');
const road = require('lr-main')('client');
road
.extension('renderer', renderer, true);
renderer.render(html, placeholder)
renderer.render('<section>...</section>', '.placeholderName');
Add component to the template.
html:string
The components html that you want to load.
placeholder:string
A html selector that should be the parent of the html you want to add. The contents of the placeholder will be replaced with the new html.