@dot-event/controller

0.0.17 • Public • Published

@dot-event/controller

dot-event dom controllers

controller

Install

npm install dot-event @dot-event/controller

Setup

const dot = require("dot-event")()
require("@dot-event/controller")(dot)

Usage

First create your controller composer:

module.exports = function(dot) {
  dot.controller("myController", myController)
}

async function myController() {
  // control stuff
}

Then use it:

require("./myController")(dot)
dot.myController()

Props

Commonly we append the controller name to the prop array and pass the concatenated props to sub-events.

Passing those props down produces descriptive element ids and logs that describe the call stack.

Luckily, the controller composer injects the controller name into the prop array automatically, eliminating the controller name append step.

ℹ️ Prop injection is the only thing the controller composer does at this point in time.

Related composers

Library Description URL
el DOM elements https://github.com/dot-event/el#readme
render Server side render https://github.com/dot-event/render#readme
view DOM views https://github.com/dot-event/view#readme

Dependents (0)

Package Sidebar

Install

npm i @dot-event/controller

Weekly Downloads

0

Version

0.0.17

License

MIT

Unpacked Size

4.8 kB

Total Files

5

Last publish

Collaborators

  • winton