Feat resumability (#547)

* add resumability functionality

---------

Co-authored-by: arc-alex <ac@omnivox.dk>
Co-authored-by: Carlos Valente <34649812+cpvalente@users.noreply.github.com>
This commit is contained in:
Alex Christoffer Rasmussen
2023-10-24 08:33:17 +02:00
committed by GitHub
parent b34fe71995
commit a84c0654e2
12 changed files with 453 additions and 33 deletions
@@ -23,6 +23,18 @@ export class EventLoader {
// eslint-disable-next-line @typescript-eslint/no-this-alias -- this logic is used to ensure singleton
instance = this;
this.eventNow = null;
this.publicEventNow = null;
this.eventNext = null;
this.publicEventNext = null;
this.loaded = {
selectedEventIndex: null,
selectedEventId: null,
selectedPublicEventId: null,
nextEventId: null,
nextPublicEventId: null,
numEvents: 0,
};
}
// we need to delay init until the store is ready
@@ -71,7 +83,7 @@ export class EventLoader {
* @param {string} eventId
* @return {object | undefined}
*/
static getEventWithId(eventId) {
static getEventWithId(eventId): OntimeEvent | undefined {
const timedEvents = EventLoader.getTimedEvents();
return timedEvents.find((event) => event.id === eventId);
}
@@ -223,7 +235,7 @@ export class EventLoader {
* loads an event given its id
* @param {object} event
*/
loadEvent(event) {
loadEvent(event?: OntimeEvent) {
if (typeof event === 'undefined') {
return null;
}