mirror of
https://github.com/TryGhost/Ghost.git
synced 2024-11-24 06:35:49 +03:00
6dde5e40e3
refs https://github.com/TryGhost/Toolbox/issues/345 - this commit bumps `eslint-plugin-ghost`, which bumps compatiblity to 2022 - this also removes a lot of the manually-added `parserOptions.ecmaVersion` that we had in imported packages, in favor of the value set in `eslint-plugin-ghost` |
||
---|---|---|
.. | ||
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);