You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
iot/projects/IoTCenter/wwwroot/js/index.js

44 lines
1.3 KiB

isDebug = true;
useSignalR = true;
dataUrl = baseUrl + '/App/GetProducts';
data = function data() {
return {
f7params: f7params,
server: localStorage.getItem('server'),
token: localStorage.getItem('token'),
model: {
products: [],
scenes: []
}
};
};
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) {
var item = JSON.parse(json);
if (method === 'ProductEntityInserted' ||
method === 'ProductEntityUpdated' ||
method === 'ProductEntityDeleted' ||
method === 'DeviceEntityInserted' ||
//method === 'DeviceEntityUpdated' ||
method === 'DeviceEntityDeleted') {
loadData();
}
else if (method === 'SceneEntityInserted' ||
method === 'SceneEntityUpdated' ||
method === 'SceneEntityDeleted') {
if (item.nodeId === null) {
loadData();
}
}
}
start();