summaryrefslogtreecommitdiffhomepage
path: root/gui/src/renderer/lib
diff options
context:
space:
mode:
Diffstat (limited to 'gui/src/renderer/lib')
-rw-r--r--gui/src/renderer/lib/history.tsx18
1 files changed, 18 insertions, 0 deletions
diff --git a/gui/src/renderer/lib/history.tsx b/gui/src/renderer/lib/history.tsx
index 2eb08d001d..9a0205b382 100644
--- a/gui/src/renderer/lib/history.tsx
+++ b/gui/src/renderer/lib/history.tsx
@@ -2,6 +2,7 @@ import { Action, History as OriginalHistory, Location, LocationDescriptorObject
import React from 'react';
import { RouteComponentProps, useHistory as useReactRouterHistory, withRouter } from 'react-router';
+import { IHistoryObject } from '../../shared/ipc-types';
import { GeneratedRoutePath, RoutePath } from './routes';
export interface ITransitionSpecification {
@@ -61,6 +62,15 @@ export default class History {
this.entries = [this.createLocation(location, state)];
}
+ public static fromSavedHistory(savedHistory: IHistoryObject): History {
+ const history = new History(RoutePath.launch);
+ history.entries = savedHistory.entries;
+ history.index = savedHistory.index;
+ history.lastAction = savedHistory.lastAction;
+
+ return history;
+ }
+
public get location(): Location<S> {
return this.entries[this.index];
}
@@ -126,6 +136,14 @@ export default class History {
return this as OriginalHistory;
}
+ public get asObject(): IHistoryObject {
+ return {
+ entries: this.entries,
+ index: this.index,
+ lastAction: this.lastAction,
+ };
+ }
+
public block(): never {
throw Error('Not implemented');
}