Support resetting styles

This commit is contained in:
lukasmartinelli
2016-09-21 08:34:48 +02:00
parent 9d4053dd78
commit 442a7f612c
4 changed files with 24 additions and 1 deletions
+10
View File
@@ -91,6 +91,16 @@ export class StyleStore {
this.mapStyles = loadStoredStyles()
}
// Delete entire style history
purge() {
for (let i = 0; i < window.localStorage.length; i++) {
const key = window.localStorage.key(i)
if(key.startsWith(storagePrefix)) {
window.localStorage.removeItem(key)
}
}
}
// Find the last edited style
latestStyle() {
if(this.mapStyles.length === 0) return emptyStyle