Skip to content
Snippets Groups Projects
Commit 54fb9bee authored by Alexander Rose's avatar Alexander Rose
Browse files

add State.Snapshots.OpenUrl

parent 27ebbc50
No related branches found
No related tags found
No related merge requests found
......@@ -187,4 +187,9 @@ export function Snapshots(ctx: PluginContext) {
PluginCommands.State.Snapshots.OpenFile.subscribe(ctx, ({ file }) => {
return ctx.managers.snapshot.open(file);
});
PluginCommands.State.Snapshots.OpenUrl.subscribe(ctx, async ({ url, type }) => {
const data = await ctx.runTask(ctx.fetch({ url, type: 'binary' }));
return ctx.managers.snapshot.open(new File([data], `state.${type}`));
});
}
\ No newline at end of file
......@@ -37,8 +37,9 @@ export const PluginCommands = {
Upload: PluginCommand<{ name?: string, description?: string, playOnLoad?: boolean, serverUrl: string, params?: PluginState.SnapshotParams }>(),
Fetch: PluginCommand<{ url: string }>(),
DownloadToFile: PluginCommand<{ name?: string, type: 'json' | 'molj' | 'zip' | 'molx', params?: PluginState.SnapshotParams }>(),
DownloadToFile: PluginCommand<{ name?: string, type: PluginState.SnapshotType, params?: PluginState.SnapshotParams }>(),
OpenFile: PluginCommand<{ file: File }>(),
OpenUrl: PluginCommand<{ url: string, type: PluginState.SnapshotType }>(),
}
},
Interactivity: {
......
......@@ -166,4 +166,6 @@ namespace PluginState {
structureFocus?: StructureFocusSnapshot,
durationInMs?: number
}
export type SnapshotType = 'json' | 'molj' | 'zip' | 'molx'
}
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment