Skip to content

Latest commit

 

History

History
39 lines (28 loc) · 1.3 KB

components.md

File metadata and controls

39 lines (28 loc) · 1.3 KB

SYSTEM/components

Table of contents

Properties

.hooks

Hooks represent a hooks instance, which allows to manipluate methods calls. See: hooks

.events

EventEmitter instance, to listen for events that happen in the components. E.g. Method was called and has finished.

.items

Array that holds instances of the implementing class.
E.g. devices in the devices component

Methods

defineMethod(name, worker)

  • name {String} Method name that is used to Object.defineProperty on the component instance.
  • worker {Function} Worker that handles the implementation of your function

Defines a method on this/class instance which is hoockable with pre/post hooks and emit events

init(worker)

  • worker {Function} Worker that initialise the component

worker is called like this worker(this, cb), so when the initalizien is complete, "cb" is called and emits "ready". The init function is used to fill the .items array for example.