73bd9a8e1a
- these aren't needed any more because the packages are in the same repo
as Ghost, so jsdocs + types should Just Work ™️
|
||
---|---|---|
.. | ||
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);