|
|
|
@ -25,6 +25,7 @@ export class EditorAction {
|
|
|
|
|
mapEditor: IMapEditor | null = null; |
|
|
|
|
store: IStore; |
|
|
|
|
id: string; |
|
|
|
|
autoSaveTimer: number = -1; |
|
|
|
|
|
|
|
|
|
constructor(store: IStore) { |
|
|
|
|
this.store = store; |
|
|
|
@ -60,9 +61,7 @@ export class EditorAction {
|
|
|
|
|
this._openProject(JSON.parse(cached)); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
setInterval(() => { |
|
|
|
|
this.saveTemp(); |
|
|
|
|
}, AutoCacheInterval); |
|
|
|
|
this.autoSaveTimer = setTimeout(() => this.saveTemp(), AutoCacheInterval); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
// ---------- public methods -------------
|
|
|
|
@ -125,8 +124,10 @@ export class EditorAction {
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
async saveTemp() { |
|
|
|
|
clearTimeout(this.autoSaveTimer); |
|
|
|
|
await setItem(this.id, JSON.stringify(this._getMapOptions())); |
|
|
|
|
message.success("暂存成功~"); |
|
|
|
|
this.autoSaveTimer = setTimeout(() => this.saveTemp(), AutoCacheInterval); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
clearOverlays() { |
|
|
|
@ -209,6 +210,7 @@ export class EditorAction {
|
|
|
|
|
|
|
|
|
|
private _bindActions() { |
|
|
|
|
this.saveGeoJSON = this.saveGeoJSON.bind(this); |
|
|
|
|
this.saveTemp = this.saveTemp.bind(this); |
|
|
|
|
this.saveProject = this.saveProject.bind(this); |
|
|
|
|
this.openGeoJSON = this.openGeoJSON.bind(this); |
|
|
|
|
this.openProject = this.openProject.bind(this); |
|
|
|
|