@kayahr/ed-journal
Version:
Typescript library to read/watch the player journal of Frontier's game Elite Dangerous
34 lines • 983 B
JavaScript
/*
* Copyright (C) 2022 Klaus Reimer <k@ailis.de>
* See LICENSE.md for licensing information.
*/
/** Registered journal event updates. */
const journalEventUpdates = new Map();
/**
* Registers a journal event update.
*
* @param event - Tje event name.
* @param update - The update function to register.
*/
export function registerJournalEventUpdate(event, update) {
journalEventUpdates.set(event, update);
}
/** Map from deprecated event names to new ones. */
const eventNameUpdates = {
ShipLockerMaterials: "ShipLocker",
BackPack: "Backpack",
BackPackMaterials: "Backpack"
};
/**
* Updates the given journal event if necessary.
*
* @param event - The journal event to update.
*/
export function updateJournalEvent(event) {
const newEventName = eventNameUpdates[event.event];
if (newEventName != null) {
event.event = newEventName;
}
journalEventUpdates.get(event.event)?.(event, event);
}
//# sourceMappingURL=JournalEvent.js.map