Fix local update to right this

This commit is contained in:
Lukas Martinelli 2017-01-01 15:51:22 +01:00
parent fa38667125
commit e92dfd8284

View file

@ -28,14 +28,14 @@ export class ApiStyleStore {
notifyLocalChanges() {
const connection = new ReconnectingWebSocket(websocketUrl)
connection.onmessage = function(e) {
connection.onmessage = e => {
if(!e.data) return
console.log('Received style update from API')
try {
console.log('Received style update from API')
const updatedStyle = style.ensureStyleValidity(JSON.parse(e.data))
this.onLocalStyleChange(updatedStyle)
} catch(err) {
console.error('Cannot parse local file ' + e.data)
console.error('Could not parse local style')
}
}
}