0.0.3 • Published 2 months ago

@meteora-digital/classy v0.0.3

Weekly downloads
-
License
MIT
Repository
github
Last release
2 months ago

Classy

Extend this class to add 'on' event listeners to your other es6 classes

Installation

npm i @meteora-digital/classy
yarn add @meteora-digital/classy

Usage

import Classy from '@meteora-digital/classy';

// Create a new class that extends Classy
class MyClassController extends Classy {
  constructor() {
    super();
  }

  init() {
    // Do something

    // Include the callback method in your class to trigger the event
    this.callback('init', data);
  }
}

// Create a new instance of your class
const MyClass = new MyClassController();

// Add an event listener to your class
MyClass.on('init', (data) => {
  // do something with the data
});

// Trigger the method, which will trigger the event
MyClass.init();

License

MIT

0.0.3

2 months ago

0.0.2

2 years ago

0.0.1

2 years ago

0.0.0

2 years ago