This package has been deprecated

Author message:

deprecated in favor of built-in Etch hooks starting in Etch 0.6.0

etch-hooks

0.1.0 • Public • Published

etch-hooks

etch-hooks is a library to facilitate hooking into the Etch component lifecycle.

Overview

It can be useful to hook into the Etch component lifecycle. etch-hooks allows you to hook into either (or both) of the etch.initialize and etch.update methods:

import hooks from 'etch-hooks'

class MyComponent {
  constructor () {
    hooks.onInitialize(this, this.onUpdate)
    hooks.onUpdate(this, this.onUpdate)

    etch.initialize(this)
    // the `onInitialize` hook runs here
  }

  async update (props, children) {
    // ...
    await etch.update(this)
    // the `onUpdate` hook runs here;
    // remember that `etch.update` is asynchronous and returns a promise
  }

  onUpdate () {
    console.log("I've been rendered!")
  }

  render () {
    // ...
  }
}

Package Sidebar

Install

npm i etch-hooks

Weekly Downloads

1

Version

0.1.0

License

MIT

Last publish

Collaborators

  • binarymuse