1.0.1 • Published 6 years ago

bidello v1.0.1

Weekly downloads
12
License
MIT
Repository
github
Last release
6 years ago

👨‍🏫 bidello

Don't leave your Class alone.

bidello is a simple class Mixin and event system.

How to use it

npm install bidello

and then

import { component } from 'bidello';

class YourClass extends component() {
  init() {
    //...
  }
}

And so?

You can extend your classes, and trigger methods by global events.

import bidello, { component } from 'bidello';

class YourClass extends component() {
  onResize({ width, height }) {

  }

  onVisibility({ visible }) {

  }

  onRaf() {

  }
};

// Anywhere else in your code...
bidello.trigger({ name: 'resize', fireAtStart: true }, {
  width: window.innerWidth,
  height: window.innerHeight,
});

bidello.trigger({ name: 'onVisibility' }, {
  visible: false,
});

bidello.trigger({ name: 'raf' });

The fireAtStart flag, if true, will force the onResize method to be called for any new classes created in the future (automatically passing the last known data)

Look at antipasto for a real example.

1.0.1

6 years ago

1.0.0

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago