mirror of
https://github.com/captbaritone/webamp
synced 2024-11-23 00:34:42 +00:00
Make state serialization opt-in (for now)
This commit is contained in:
parent
3f1861d4f8
commit
bef421ebed
@ -87,12 +87,14 @@ const MIN_MILKDROP_WIDTH = 725;
|
||||
|
||||
let screenshot = false;
|
||||
let clearState = false;
|
||||
let useState = false;
|
||||
let skinUrl = configSkinUrl;
|
||||
if ("URLSearchParams" in window) {
|
||||
const params = new URLSearchParams(location.search);
|
||||
screenshot = params.get("screenshot");
|
||||
skinUrl = params.get("skinUrl") || skinUrl;
|
||||
clearState = Boolean(params.get("clearState"));
|
||||
useState = Boolean(params.get("useState"));
|
||||
}
|
||||
|
||||
function supressDragAndDrop(e) {
|
||||
@ -301,7 +303,7 @@ Raven.context(async () => {
|
||||
// Expose webamp instance for debugging and integration tests.
|
||||
window.__webamp = webamp;
|
||||
|
||||
await bindToIndexDB(webamp, clearState);
|
||||
await bindToIndexDB(webamp, clearState, useState);
|
||||
|
||||
await webamp.renderWhenReady(document.getElementById("app"));
|
||||
});
|
||||
|
@ -2,7 +2,7 @@ import IdbKvStore from "idb-kv-store";
|
||||
import { throttle } from "./utils";
|
||||
const LOCAL_STORAGE_KEY = "webamp_state";
|
||||
|
||||
export async function bindToIndexDB(webamp, clearState) {
|
||||
export async function bindToIndexDB(webamp, clearState, useState) {
|
||||
const localStore = new IdbKvStore("webamp_state_database");
|
||||
|
||||
if (clearState) {
|
||||
@ -13,6 +13,10 @@ export async function bindToIndexDB(webamp, clearState) {
|
||||
}
|
||||
}
|
||||
|
||||
if (!useState) {
|
||||
return;
|
||||
}
|
||||
|
||||
let previousSerializedState = null;
|
||||
try {
|
||||
previousSerializedState = await localStore.get(LOCAL_STORAGE_KEY);
|
||||
|
Loading…
Reference in New Issue
Block a user