hyperscript-string-async
v1.0.1
Published
An async/promisified version of hyperscript-string
Downloads
4
Maintainers
Readme
hyperscript-string-async
An async/promisified version of hyperscript-string
Installation
Install hyperscript-string-async
using npm:
npm install --save hyperscript-string-async
Usage
Module usage
const h = require('hyperscript-string-async');
h('ul.list', [
h('li.item', 'Lorem ipsum'),
h('li.item', {title: 'Second item'}, 'Dolor sit'),
h('li.item', 'Amet')
])
.then(html => {
/*
<ul class="list">
<li class="item">Lorem ipsum</li>
<li title="Second item" class="item">Dolor sit</li>
<li class="item">Amet</li>
</ul>
*/
});
Related packages
hyperscript-string
- Create HTML strings with JavaScripthyperscript-normalize-args
- A hyperscript helper to normalize component arguments, for easier creation of reusable componentshyperscript-helpers
- Terse syntax for hyperscripthyperscript
- Create HyperText with JavaScript, on client or server.
API
ha(selector[, attrs, children])
| Name | Type | Description |
|------|------|-------------|
| selector | String
or Promise<String>
| Contains at least the HTML tag name |
| attrs | Object
or Promise<Object>
or Object<Promise>
| Attributes for the HTML tag |
| children | String
or Array
or Promise<String>
or Promise<Array>
or Array<Promise>
| The children for the HTML tag |
Returns: Promise<String>
, the generated HTML.
License
MIT © Joakim Carlstein