mirror of
https://github.com/maputnik/editor.git
synced 2026-01-06 13:30:03 +00:00
Fix local update to right this
This commit is contained in:
@@ -28,14 +28,14 @@ export class ApiStyleStore {
|
|||||||
|
|
||||||
notifyLocalChanges() {
|
notifyLocalChanges() {
|
||||||
const connection = new ReconnectingWebSocket(websocketUrl)
|
const connection = new ReconnectingWebSocket(websocketUrl)
|
||||||
connection.onmessage = function(e) {
|
connection.onmessage = e => {
|
||||||
if(!e.data) return
|
if(!e.data) return
|
||||||
|
console.log('Received style update from API')
|
||||||
try {
|
try {
|
||||||
console.log('Received style update from API')
|
|
||||||
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
|
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
|
||||||
this.onLocalStyleChange(updatedStyle)
|
this.onLocalStyleChange(updatedStyle)
|
||||||
} catch(err) {
|
} catch(err) {
|
||||||
console.error('Cannot parse local file ' + e.data)
|
console.error('Could not parse local style')
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user