You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
49 lines
1.1 KiB
49 lines
1.1 KiB
import { createVersionedStore } from "@/utils/storage"; |
|
|
|
import { MWSettingsData, MWSettingsDataV1 } from "./types"; |
|
|
|
export const SettingsStore = createVersionedStore<MWSettingsData>() |
|
.setKey("mw-settings") |
|
.addVersion({ |
|
version: 0, |
|
create(): MWSettingsDataV1 { |
|
return { |
|
language: "en", |
|
captionSettings: { |
|
delay: 0, |
|
style: { |
|
color: "#ffffff", |
|
fontSize: 25, |
|
backgroundColor: "#00000096", |
|
}, |
|
}, |
|
}; |
|
}, |
|
migrate(data: MWSettingsDataV1): MWSettingsData { |
|
return { |
|
language: data.language, |
|
captionSettings: { |
|
language: "none", |
|
...data.captionSettings, |
|
}, |
|
}; |
|
}, |
|
}) |
|
.addVersion({ |
|
version: 1, |
|
create(): MWSettingsData { |
|
return { |
|
language: "en", |
|
captionSettings: { |
|
delay: 0, |
|
language: "none", |
|
style: { |
|
color: "#ffffff", |
|
fontSize: 25, |
|
backgroundColor: "#00000096", |
|
}, |
|
}, |
|
}; |
|
}, |
|
}) |
|
.build();
|
|
|