npm.io
0.5.4 • Published 6 years ago

vanilla-ele

Licence
Version
0.5.4
Deps
1
Size
16 kB
Vulns
0
Weekly
0

vanilla-element

Example:

Easy create HTMLElement:

import vanillaElement from 'vanilla-ele';

const buttonFuture = Ele.future()

  const body = vanillaElement("div", { className: bem`_body` }, [
    vanillaElement("div", {
      onclick: handleGoToUserClick,
      className: bem`_goToUser`,
      textContent: "go to user"
    }),
    ...Array(50)
      .fill(0)
      .map((v, i) => {
        return vanillaElement("div", { textContent: "label" + i });
      }),
    buttonFuture.bindElement("div", {
      onclick: handleGoToUserClick,
      className: bem`_goToUser`,
      textContent: "go to user2"
    })
  ]);

  console.log(buttonFuture.target);