diff --git a/apps/mtnclock/app.js b/apps/mtnclock/app.js index f61c7fd4e..4cc42dde9 100644 --- a/apps/mtnclock/app.js +++ b/apps/mtnclock/app.js @@ -329,36 +329,20 @@ function readWeather() { var weatherJson = require("Storage").readJSON('weather.json', 1); // save updated weather data if available and it has been an hour since last updated if (weatherJson && weatherJson.weather && weatherJson.weather.time && (data.time === undefined || (data.time + 3600000) < weatherJson.weather.time)) { - const newSettings = { - time: weatherJson.weather.time, - temp: weatherJson.weather.temp, - code: weatherJson.weather.code - }; - require("Storage").writeJSON( - 'mtnclock.json', - Object.assign( - require("Storage").readJSON('mtnclock.json', 1), - newSettings - ) - ); + data.time = weatherJson.weather.time; + data.temp = weatherJson.weather.temp; + data.code = weatherJson.weather.code; + require("Storage").writeJSON('mtnclock.json', data); } } const _GB = global.GB; global.GB = (event) => { if (event.t==="weather") { - const newSettings = { - temp: event.temp, - code: event.code, - time: Date.now() - }; - require("Storage").writeJSON( - 'mtnclock.json', - Object.assign( - require("Storage").readJSON('mtnclock.json', 1), - newSettings - ) - ); + data.temp = event.temp; + data.code = event.code; + data.time = Date.now(); + require("Storage").writeJSON('mtnclock.json', data); setWeather(); } if (_GB) setTimeout(_GB, 0, event);