hyperscript-string-async

1.0.1 • Public • Published

hyperscript-string-async

Build status NPM version XO code style

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

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

Package Sidebar

Install

npm i hyperscript-string-async

Weekly Downloads

1

Version

1.0.1

License

MIT

Last publish

Collaborators

  • joakimbeng