isDebug = true; useSingalR = false; dataUrl = iotCenter + '/App/GetProducts'; data = function data() { return { f7params: f7params, server: localStorage.getItem('server'), token: localStorage.getItem('token'), model: { Products: [], Scenes: [] } }; } function mounted() { if (isApp) { if (!this.server) { location.href = "config.html"; } if (!this.token) { location.href = "login.html"; } } }; methods = { GetProducts() { return Enumerable.from(this.model.Products).orderBy('o=>o.DisplayOrder').toArray(); }, GetScenes() { return Enumerable.from(this.model.Scenes).orderBy('o=>o.DisplayOrder').toArray(); }, CallScene(id) { ajax('/App/ExecGlobalScene', { token: token, connectionId: connectionId, id: id }, 'post'); } }; function onMessage(method, json, to, from) { debug(method + ':' + json); var item = JSON.parse(json); console.log(method + ':' + json); var item = JSON.parse(json); if (method == 'ProductEntityInserted' || method == 'ProductEntityUpdated' || method == 'ProductEntityDeleted' || method == 'DeviceEntityInserted' || method == 'DeviceEntityDeleted' || method == 'DeviceEntityDeleted') { loadData(); } else if (method == 'SceneEntityInserted' || method == 'SceneEntityUpdated' || method == 'SceneEntityDeleted') { if (item.NodeId == null) { loadData(); } } } start();