Ghost/ghost/link-redirects/lib/RedirectEvent.js

25 lines
534 B
JavaScript
Raw Normal View History

/**
* @typedef {object} RedirectEventData
* @prop {URL} url
* @prop {import('./LinkRedirect')} link
*/
module.exports = class RedirectEvent {
/**
* @param {RedirectEventData} data
* @param {Date} timestamp
*/
constructor(data, timestamp) {
this.data = data;
this.timestamp = timestamp;
}
/**
* @param {RedirectEventData} data
* @param {Date} [timestamp]
*/
static create(data, timestamp) {
return new RedirectEvent(data, timestamp ?? new Date);
}
};