08b786af3b
- this was all getting terribly behind so I've done several things: - majority of `@tryghost/*` except Lexical packages - gscan + knex-migrator to remove old `@tryghost/errors` usage - bumped lockfile |
||
---|---|---|
.. | ||
lib | ||
test | ||
.eslintrc.js | ||
index.js | ||
package.json | ||
README.md |
Domain Events
Usage
const DomainEvents = require('@tryghost/domain-events');
class MyEvent {
constructor(message) {
this.timestamp = new Date();
this.data = {
message
};
}
}
DomainEvents.subscribe(MyEvent, function handler(event) {
console.log(event.data.message);
});
const event = new MyEvent('hello world');
DomainEvents.dispatch(event);