@biorate/lifecycled
TypeScript icon, indicating that this package has built-in type declarations

1.54.0 • Public • Published

Lifecircle

Decorators pack for bring lifecycle control in you application

Example:

import { lifecycled, init, kill } from '../../src';

class Uno {
  @init() public initialize() {
    console.log('Uno init');
  }

  @kill() public destructor() {
    console.log('Uno kill');
  }
}

class Dos {
  @init() public initialize() {
    console.log('Dos init');
  }

  @kill() public destructor() {
    console.log('Dos kill');
  }
}

class Tres {
  @init() public initialize() {
    console.log('Tres init');
  }

  @kill() public destructor() {
    console.log('Tres kill');
  }
}

class Root {
  uno = new Uno();
  dos = new Dos();
  tres = new Tres();
}

lifecycled(new Root());

// Uno init
// Dos init
// Tres init
// Uno kill
// Dos kill
// Tres kill

Learn

  • Documentation can be found here - docs.

Release History

See the CHANGELOG

License

MIT

Copyright (c) 2021-present Leonid Levkin (llevkin)

Readme

Keywords

none

Package Sidebar

Install

npm i @biorate/lifecycled

Weekly Downloads

9

Version

1.54.0

License

MIT

Unpacked Size

201 kB

Total Files

58

Last publish

Collaborators

  • llevkin