0.0.14 ā€¢ Published 5 years ago

@emit-js/el v0.0.14

Weekly downloads
-
License
MIT
Repository
github
Last release
5 years ago

@emit-js/el

emit dom elements

element

What is it?

This library allows you to write JSX to define pure DOM elements and manage element lists.

āœ… SSR Ā  šŸš« No virtual dom!

Install

npm install @emit-js/emit @emit-js/el

Setup

const emit = require("@emit-js/emit")
require("@emit-js/el")(emit)

Usage

The emit.el API works well with JSX and view components:

/** @jsx emit.el */

module.exports = function(emit) {
  emit.view("myView", { render })
}

function render(arg, prop, emit) {
  return <div id={prop} />
}

Then use it:

require("./myView")(emit)
emit.myView("myId") // `render` element to #myId

List helper

A common pattern is to set an array of objects in the store:

emit.set("myId", [{id: 1}, {id: 2}])

And create a list of elements using a particular view component:

emit.elList("myId", { event: "myView" })

The emit.elList helper works with SSR elements, removing, updating, and inserting where necessary.

Related composers

LibraryDescriptionURL
controllerDOM controllerhttps://github.com/emit-js/controller#readme
renderServer side renderhttps://github.com/emit-js/render#readme
viewDOM viewhttps://github.com/emit-js/view#readme

Credit

This library borrows heavily from attodom.

0.0.14

5 years ago

0.0.12

5 years ago