1.0.0 • Published 4 years ago

asevent v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
4 years ago

asevent

Let a class have functions related to events

example

import { inheritAsEvent } from 'asevent';

function Example() {
    //...
}

Example.prototype.doSomething = function() {
    // todo some
}


inheritAsEvent(Example);


var example = new Example();


example.on('custom', function(event) {
    console.log(event);
})

// {a: 1, b: 2}

example.trigger('custom', {a: 1, b: 2});
1.0.0

4 years ago