Ghost/ghost/member-events/lib/MemberSubscribeEvent.js

25 lines
561 B
JavaScript
Raw Normal View History

/**
* @typedef {object} MemberSubscribeEventData
* @prop {string} memberId
* @prop {string} source
*/
module.exports = class MemberSubscribeEvent {
/**
* @param {MemberSubscribeEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {MemberSubscribeEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new MemberSubscribeEvent(data, timestamp || new Date);
}
};