/* This code snippet is taken from from the 'gettingStarted' BajaScript tutorial. More information can be found by navigating to this ORD... module://docDeveloper/doc/jsdoc/bajaux-ux/tutorial-gettingStarted.html */ let baja_my_user_account_func, //設定使用者帳號 baja_prepare_specify_subscribe_devices = [], //設定要訂閱的設備 baja_all_emergency_devices = [], //所有緊急應變的設備 baja_emergency_alarm_func, //設定回傳的緊急應變設備編號Function baja_target_func, //設定回傳指定訂閱設備編號Function baja_specify_subscribe_real_time_device = [], //設定即時顯示的設備 baja_target_real_time_func; //設定回傳即時顯示設備的Function var baja_specify_alarm_device_number = []; var baja_emergency_alarm_device_number = []; //要回傳的緊急應變的異常設備 var baja_specify_real_time_device_number = []; var user_name = ""; function MyBaja() { this.setMyUserAccount = function (callBackFunc) { if (callBackFunc != undefined && callBackFunc != null) { baja_my_user_account_func = callBackFunc; } }; this.setPrepareSubscribeDevices = function (devices) { baja_prepare_specify_subscribe_devices = devices; BajaSpecifySubscribeDevices(); //執行訂閱設備 }; //設定要回傳緊急應變的Function this.setEmergencyCallBack = function (callBackFunc) { if (callBackFunc != undefined && callBackFunc != null) { baja_emergency_alarm_func = callBackFunc; } } this.setCallBack = function (callBackFunc) { if (callBackFunc != undefined && callBackFunc != null) { baja_target_func = callBackFunc; } }; this.setSSC = function (device) { SetDeviceSSCPoint(device) } this.setSubscribeRealtimeReportDevices = function (devices) { baja_specify_subscribe_real_time_device = devices; BajaSpecifySubscribeRealtimeReportDevices(); //執行訂閱設備 }; this.setRealtimeReportCallBack = function (callBackFunc) { if (callBackFunc != undefined && callBackFunc != null) { baja_target_real_time_func = callBackFunc; } }; } function SetDeviceSSCPoint(device) { require(['baja!'], function (baja) { var sub = new baja.Subscriber(); var device_number_split = device.device_number.split("_"); device_number_split = device_number_split.map(function (item) { var first = item.substr(0, 1); if (!isNaN(parseInt(first))) { return "$3" + item; } else { return item; } }); /** * 針對傳入設備抓取點位 */ baja.Ord.make("local:|foxs:|station:|slot:/Arena/" + device_number_split.slice(0, 4).join("/") + "/" + device.device_number) .get() .then(function (folder) { folder.getSlots().isComponent().eachValue(function (point) { if (point.getDisplayName() == "SSC") { sub.subscribe({ comps: point, }); point.set1({ value: device.SSC }) sub.unsubscribeAll(); sub.detach(); } }); }); }); } function update_baja_specify_alarm_device_number(point) { var target_device_number = point.$parent.getDisplayName().split('_').slice(0, 5).join('_'); var point_name = point.getDisplayName() // console.log("target_device_number", target_device_number) // console.log(point.getOutDisplay()); var facets_split = point.getFacets1().$cEncStr.split('|'); var facets_arr = []; facets_split.forEach(function (item, index) { facets_arr.push(item.split('=s:')); }); var facets = facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}) var point_out_split = point.getOutDisplay().split(' '); let key = Object.keys(facets).find(k => facets[k] === point_out_split[0]); //判斷設備是否已存在 var index = baja_specify_alarm_device_number.findIndex(x => x.device_number == target_device_number) if (index < 0) { //設備不存在則新增 baja_specify_alarm_device_number.push( { device_number: target_device_number, points: {}, // finish: 1, // alarm_timestamp: str_date }); //新增點位 if (key != undefined && key != null && point_name != "ER") { var mypoint = { [point_name]: key } } else { var mypoint = { [point_name]: point_out_split[0] } } var renew_index = baja_specify_alarm_device_number.findIndex(x => x.device_number == target_device_number) baja_specify_alarm_device_number[renew_index].points = mypoint; } else { //設備存在則修改 //判斷點位是否存在 var point_key = Object.keys(baja_specify_alarm_device_number[index].points).find(k => k === point_name); if (point_key != undefined && point_key != null && point_name != "ER") { baja_specify_alarm_device_number[index].points[point_key] = key } else { baja_specify_alarm_device_number[index].points[point_name] = point_out_split[0] } } // if (temp[0].facets != undefined || temp[0].facets != null) { // let key = Object.keys(temp[0].facets).find(k => temp[0].facets[k] === arr_point_alarm[0]); // date = new Date(); // str_date = date.getFullYear() + ("0" + (date.getMonth() + 1)).slice(-2) + ("0" + date.getDate()).slice(-2) + ("0" + date.getHours()).slice(-2) + ("0" + date.getMinutes()).slice(-2) + ("0" + date.getSeconds()).slice(-2) // if (/true/.test(key)) { // if (baja_specify_alarm_device_number.findIndex(x => x.device_number == target_device_number) < 0) { // baja_specify_alarm_device_number.push({ device_number: target_device_number, finish: 1, alarm_timestamp: str_date }); // } // } else if (/false/.test(key)) { // var index = baja_specify_alarm_device_number.findIndex(x => x.device_number == target_device_number) // if (index >= 0) { // baja_specify_alarm_device_number.splice(index, 1); // } // } // console.log("baja_specify_alarm_device_number", baja_specify_alarm_device_number); // } } /** * 使用者指定要訂閱設備的Function */ function BajaSpecifySubscribeDevices() { require(['baja!'], function (baja) { var sub = new baja.Subscriber(); sub.attach('changed', function (prop) { // console.log("sub changed", prop) if (prop.getName() === 'out') { // console.log(`變更的項目${this.getDisplayName()}`, this); update_baja_specify_alarm_device_number(this) } if (baja_target_func != undefined && baja_target_func != null) { baja_target_func(baja_specify_alarm_device_number); } }); var start = new Date().getTime(); var total = 0; var pre_subtime = 0 var temp_subtime = 0; var total_subtime = 0; console.log("設備迴圈開始執行", start); baja_prepare_specify_subscribe_devices.forEach(function (device, index) { var string_change_start = new Date().getTime(); var device_number_split = device.device_number.split("_"); device_number_split = device_number_split.map(function (item) { var first = item.substr(0, 1); if (!isNaN(parseInt(first))) { return "$3" + item; } else { return item; } }); var string_change_end = new Date().getTime(); console.log("字串路徑替換花費時間", (string_change_end - string_change_start) / 1000 + "sec") /** * 針對傳入設備抓取點位 */ baja.Ord.make("local:|foxs:|station:|slot:/Arena/" + device_number_split.slice(0, 4).join("/") + "/" + device.device_number) .get() .then(function (folder) { var sub_start = new Date().getTime(); if(temp_subtime == 0){ pre_subtime = start; } temp_subtime = (sub_start - pre_subtime) pre_subtime = sub_start; total_subtime += temp_subtime; console.log("進入多資料夾設備的時間點", sub_start) console.log("進入多資料夾設備花費時間", temp_subtime / 1000 + "sec") console.log("進入多資料夾設備總花費時間", total_subtime / 1000 + "sec") folder.getSlots().isComponent().eachValue(function (point) { sub.subscribe({ comps: point, }); }); sub_end = new Date().getTime(); console.log("多資料夾設備所有點位訂閱花費時間", (sub_end - sub_start) / 1000 + "sec") var xxx = (sub_end - sub_start) total += (sub_end - sub_start) console.log("多資料夾設備當前訂閱總花費時間", total / 1000 + "sec") }); }); var end = new Date().getTime(); console.log("多資料夾設備迴圈結束執行", (end - start) / 1000 + "sec") }); } require(['baja!'], function (baja) { user_name = baja.getUserName(); if (baja_my_user_account_func != undefined && baja_my_user_account_func != null) { baja_my_user_account_func(user_name); } }); function update_baja_emergency_alarm_device_number(point) { var target_device_number = point.$parent.getDisplayName().split('_').slice(0, 5).join('_'); var arr_point_alarm = point.getOutDisplay().split(' '); var temp = baja_all_emergency_devices.filter(function (item, index) { return item.device_number == target_device_number; }); if (temp[0].facets != undefined || temp[0].facets != null) { let key = Object.keys(temp[0].facets).find(k => temp[0].facets[k] === arr_point_alarm[0]); date = new Date(); str_date = date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + ("0" + date.getDate()).slice(-2) + " " + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2) + ":" + ("0" + date.getSeconds()).slice(-2) if (/true/.test(key)) { if (baja_emergency_alarm_device_number.findIndex(x => x.device_number == target_device_number) < 0) { baja_emergency_alarm_device_number.push({ device_number: target_device_number, finish: 1, alarm_timestamp: str_date }); } } else if (/false/.test(key)) { var index = baja_emergency_alarm_device_number.findIndex(x => x.device_number == target_device_number) if (index >= 0) { baja_emergency_alarm_device_number.splice(index, 1); } } } } require(['baja!'], function (baja) { var sub = new baja.Subscriber(); sub.attach('changed', function (prop) { if (prop.getName() === 'out') { update_baja_emergency_alarm_device_number(this); } //執行使用者傳入的function baja_emergency_alarm_func(baja_emergency_alarm_device_number); }); baja.Ord.make("local:|foxs:|station:|slot:/Arena|bql:select * from kitControl:Or where name like '%ER%'") // baja.Ord.make("local:|foxs:|station:|slot:/Arena|bql:select * from kitControl:Or where name like '%ER%'") .get({ cursor: { before: function () { }, each: function (item, index) { // console.log("SlotPath", this.getDisplay("slotPath")); baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath")) .get() .then(function (component) { // console.log("component", component); var target_device_number = component.$parent.getDisplayName().split('_').slice(0, 5).join('_'); var facets_split = component.getFacets1().$cEncStr.split('|'); var facets_arr = []; facets_split.forEach(function (item, index) { facets_arr.push(item.split('=s:')); }); // console.log(component.$parent.getOutDisplay()); var emergency_device = { device_number: target_device_number, facets: facets_arr.reduce((obj, cur) => ({ ...obj, [cur[0]]: cur[1] }), {}) } baja_all_emergency_devices.push(emergency_device) sub.subscribe({ comps: component, }); //初始判斷是否有發生alarm var arr_point_alarm = component.getOutDisplay().split(' '); let key = Object.keys(emergency_device.facets).find(k => emergency_device.facets[k] === arr_point_alarm[0]); date = new Date(); str_date = date.getFullYear() + "-" + ("0" + (date.getMonth() + 1)).slice(-2) + "-" + ("0" + date.getDate()).slice(-2) + " " + ("0" + date.getHours()).slice(-2) + ":" + ("0" + date.getMinutes()).slice(-2) + ":" + ("0" + date.getSeconds()).slice(-2) if (/true/.test(key)) { if (baja_emergency_alarm_device_number.findIndex(x => x.device_number == emergency_device.device_number) < 0) { baja_emergency_alarm_device_number.push({ device_number: emergency_device.device_number, finish: 1, alarm_timestamp: str_date }); } } else if (/false/.test(key)) { var index = baja_emergency_alarm_device_number.findIndex(x => x.device_number == emergency_device.device_number) if (index >= 0) { baja_emergency_alarm_device_number.splice(index, 1); } } if (baja_emergency_alarm_func != undefined) { //執行使用者傳入的function baja_emergency_alarm_func(baja_emergency_alarm_device_number); } }); }, after: function () { }, limit: -1, // Specify optional limit on the number of records (defaults to 10) offset: 0 // Specify optional record offset (defaults to 0) } }); }); function update_baja_specify_real_time_device_number(point) { var target_device_number = point.$parent.getDisplayName().split('_').slice(0, 5).join('_'); var point_name = point.getDisplayName() // console.log("target_device_number", target_device_number) // console.log(point.getOutDisplay()); var point_out_split = point.getOutDisplay().split(' '); //判斷設備是否已存在 var index = baja_specify_real_time_device_number.findIndex(x => x.device_number == target_device_number) if (index < 0) { //設備不存在則新增 baja_specify_real_time_device_number.push( { device_number: target_device_number, points: {}, }); var mypoint = { [point_name]: point_out_split[0] } var renew_index = baja_specify_real_time_device_number.findIndex(x => x.device_number == target_device_number) baja_specify_real_time_device_number[renew_index].points = mypoint; } else { //判斷點位是否存在 baja_specify_real_time_device_number[index].points[point_name] = point_out_split[0]; } } /** * 使用者指定要即時顯示的設備 */ function BajaSpecifySubscribeRealtimeReportDevices() { require(['baja!'], function (baja) { var sub = new baja.Subscriber(); sub.attach('changed', function (prop) { // console.log("sub changed", prop) if (prop.getName() === 'out') { update_baja_specify_real_time_device_number(this) } if (baja_target_real_time_func != undefined && baja_target_real_time_func != null) { baja_target_real_time_func(baja_specify_real_time_device_number); } }); // baja.Ord.make('station:|slot:/BajaScriptExamples/Components/Ramp').get({ subscriber: sub }); baja.Ord.make("local:|foxs:|station:|slot:/Arena/H/B/B1F/MVCB/H_B_B1F_MVCB_MVCBH/V1") // baja.Ord.make("local:|foxs:|alarm:|bql:select * where ackState = 'unacked' order by timestamp desc") .get().then(function (point) { // console.log(folder) // folder.getSlots().eachValue(function (point) { // console.log(point) // }) sub.subscribe({ comps: point, }); }); }); } // Subscribe to a Ramp. When it changes, print out the results. require(['baja!'], function (baja) { "use strict"; // A Subscriber is used to listen to Component events in Niagara. var sub = new baja.Subscriber(); // This shows a dialog. The function passed into 'showOk' is used to generate the dialog // box's content. // dialogs.showOk(function (dlg, jq) { // jq.text("Loading..."); // The 'update' method is called whenever the text needs to be updated. function update(point) { // $(`#${light.$propInParent.$displayName}`).html(light.getOutDisplay()); // console.log(light); // $("#Ramp1").html(light.getOutDisplay()); console.log("update function point:", point); $(`#${point.getDisplayName()}-value`).html(point.getOutDisplay()); } function update_6w(point) { // $(`#${light.$propInParent.$displayName}`).html(light.getOutDisplay()); // console.log(light); // $("#Ramp1").html(light.getOutDisplay()); // console.log("update function point:", point); $(`#${point.getDisplayName()}-value`).html(point.getOutDisplay()); } function updateIP(point) { console.log("updateIP function point:", point); $(`#${point.getDisplayName()}-ip`).html(point.getPingHost()); } // Called whenever the Ramp changes. sub.attach('changed', function (prop) { // console.log("sub changed", prop) // if (prop.getName() === 'out') { update(this); } if (prop.getName() === 'out') { update_6w(this); } // if (prop.getName() === 'pingHost') { updateIP(this); } // if (prop.getName() === 'out') { // console.log(`變更的項目${this.getDisplayName()}`, this); // // update_baja_specify_alarm_device_number(this) // } // baja_target_func(baja_specify_alarm_device_number); }); // https://127.0.0.1:8443/bajaux/webwidget/view:alarm:DatabaseView?theme=Zebra&formFactor=max&userLocalWbRc=true&attachAfterInit=false // 目前 OK local:|foxs:|alarm:|bql:select * from openAlarms // 目前 OK local:|foxs:|alarm:|bql:select * from ackPendingAlarms // 目前 OK 10.1.1.130:|foxs:|alarm:|bql:select * from ackPendingAlarms // 目前 OK alarm:|bql:select * from ackPendingAlarms // 沒資料 local:|foxs:|alarm:|view:alarm:AlarmDbView // local:|foxs:|station:|slot:/Services/OrionAlarmService // 應該有資料 欄位錯誤 service:alarmOrion:OrionAlarmService|slot:defaultAlarmClass1 // 應該有資料 service:alarm:AlarmService|slot:defaultAlarmClass // 終於有 acked local:|foxs:|alarm:|bql:select * from where ackState='acked // 紀錄可能會有機會抓到東西 local:|foxs:|station:|slot:/Drivers/BcpBacnetNetwork: select * from alarm:AlarmSourceExt // 抓取確認並倒排 local:|foxs:|alarm:|bql:select * from where ackState='acked' order by timestamp desc // 抓取未確認並倒排的設備 local:|foxs:|alarm:|bql:select * where ackState = 'unacked' order by timestamp desc // Alarm 表格 // var tableHtml = ""; // baja.Ord.make("local:|foxs:|alarm:|bql:select * where ackState = 'unacked' order by timestamp desc").get({ // cursor: { // before: function () { // // This gets called before iteration starts through the table. // // Therefore, this is where we create the headers // tableHtml = "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // ""; // // Tip: one could call this.getCollection().getColumns() to access all the columns. // }, // each: function (item, index) { // // Build up a row. Use 'getDisplay' to get a nice server formatted String. // tableHtml += "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // "" + // ""; // }, // after: function () { // // After iteration, add the end table element and pop up a dialog. // tableHtml += "
TimestampuuidSource StateackStateackRequiredSourcealarmClassprioritynormalTimeackTimeuseralarmDataalarmTransitionlastUpdate
" + (index+1) + "" + this.getDisplay("timestamp") + "" + this.getDisplay("uuid") + "" + this.getDisplay("sourceState") + "" + this.getDisplay("ackState") + "" + this.getDisplay("ackRequired") + "" + this.getDisplay("source") + "" + this.getDisplay("alarmClass") + "" + this.getDisplay("priority") + "" + this.getDisplay("normalTime") + "" + this.getDisplay("ackTime") + "" + this.getDisplay("user") + "" + this.getDisplay("alarmData") + "" + this.getDisplay("alarmTransition") + "" + this.getDisplay("lastUpdate") + "
"; // }, // limit: 100, // Specify optional limit on the number of records (defaults to 10) // offset: 0 // Specify optional record offset (defaults to 0) // } // }).then(updateAlarmTable); // function updateAlarmTable(){ // $("#alarm-table").append(tableHtml); // } var tableHtml = ""; baja.Ord.make("local:|foxs:|history:/FIC_Center/H_B_B1F_MVCB_MVCBH_V1|view:history:HistoryTable") .get(function (table) { console.log(table) table.cursor({ before: function () { // tableHtml = "" + // "" + // "" + // "" + // "" + // "" + // "" + // ""; }, each: function (item, index) { var tableContentHtml = "" + "" + "" + "" + "" + "" + ""; $("#alarm-table > table tbody").append(tableContentHtml); }, after: function () { // tableHtml += "
TimestamptrendFlagsstatusvalue
" + (index + 1) + "" + this.getDisplay("timestamp") + "" + this.getDisplay("trendFlags") + "" + this.getDisplay("status") + "" + this.getDisplay("value") + "
"; }, limit: -1, offset: 0 }); // table.cursor(function (e, index) { // console.log(e) // tableContentHtml = "" + // "" + (index + 1) + "" + // "" + this.getDisplay("timestamp") + "" + // "" + this.getDisplay("trendFlags") + "" + // "" + this.getDisplay("status") + "" + // "" + this.getDisplay("value") + "" + // ""; // $("#alarm-table > table tbody").append(tableContentHtml); // }); }).then(function (table) { tableHtml = "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "" + "
TimestamptrendFlagsstatusvalue
"; $("#alarm-table").append(tableHtml); }); //在update 的function 可以查看到Boolean狀態 local:|foxs:|station:|slot:/BajaScriptExamples/Components/BooleanWritable // Resolve the ORD to the Ramp and update the text. // baja.Ord.make('local:|foxs:|station:|slot:/Arena/H/B/B4F/FE/H_B_B4F_2A_01/H_B_B4F_2A_01_ST').get({subscriber: sub}) // .then(update); // baja.Ord.make('local:|alarm:|bql:select * from openAlarms').get({subscriber: sub}) // .then(update); // var val = 17; // baja.Ord.make("local:|foxs:|station:|slot:/Arena|bql:select * from baja:Component where name like '%ER'") // baja.Ord.make("local:|foxs:|station:|slot:/Arena/H/B/B4F/$31A") // .get() // .then(function (folders) { // batch = new baja.comm.Batch(); // console.log("查看指定路徑資料夾資訊", folders); // console.log("取得指定路徑Slots", folders.getSlots()) // folders.getSlots().eachValue(function (folder, index) { // baja.Ord.make("local:|foxs:|station:|slot:" + folder.getSlotPath().getNames().join("/")) // .get() // .then(function (folder) { // console.log("folder", folder) // folder.getSlots().is("control:BooleanWritable").eachValue(function (point) { // console.log(folder.getDisplayName() + " point", point) // console.log(folder.getDisplayName() + " Facets", point.getFacets1().$cEncStr); // $("#auto-append-wrap").append(`
// //
//
`) // sub.subscribe({ // comps: point, // // batch: batch // }); // points.push(point); // }); // }); // }); // // batch.commit(); // }); /** * 抓所有設備有ER的Component */ // var tableHtml = ""; // baja.Ord.make("local:|foxs:|station:|slot:/Arena|bql:select * from kitControl:Or where name like '%ER%'") // .get({ // cursor: { // before: function () { // }, // each: function (item, index) { // console.log("SlotPath", this.getDisplay("slotPath")); // baja.Ord.make("local:|foxs:|station:|" + this.getDisplay("slotPath")) // .get() // .then(function(component){ // console.log("component", component); // sub.subscribe({ // comps: component, // }); // }); // }, // after: function () { // }, // limit: 10, // Specify optional limit on the number of records (defaults to 10) // offset: 0 // Specify optional record offset (defaults to 0) // } // }); // baja.Ord.make("local:|foxs:|station:|slot:/Arena/H/B/B5F/$32A/$301") // .get() // .then(function (folder) { // var batch = new baja.comm.Batch(); // console.log("H_B_B5F_2A_01 folder", folder); // // For each point, invoke the 'set' Action and subscribe the point so we can // // listen for changes. // console.log("H_B_B5F_2A_01 Slots", folder.getSlots()) // folder.getSlots().is("control:BooleanWritable").eachValue(function (point) { // console.log("H_B_B5F_2A_01的point", point) // sub.subscribe({ // comps: point, // batch: batch // Pass the batch in. Doing this won't make the network call yet. // }); // // // The auto-generated action method name is called 'set1' instead of 'set'. // // // This is because there's already a method called 'set' used in 'baja.Complex'. // // // point.set1({ // // // value: val, // // // batch: batch // Pass the batch in. Doing this won't make the network call yet. // // // }); // }); // // Committing the batch will now make the network call. // // batch.commit(); // }); // baja.Ord.make("local:|foxs:|station:|slot:/Arena/H/C/B5F/VRC") // .get() // .then(function (folders) { // console.log("CCTV"); // console.log("查看指定路徑資料夾資訊", folders); // console.log("取得指定路徑Slots", folders.getSlots()) // folders.getSlots().eachValue(function (folder, index) { // baja.Ord.make("local:|foxs:|station:|slot:" + folder.getSlotPath().getNames().join("/")) // .get() // .then(function (folder) { // console.log("folder", folder) // console.log("folder getSlots", folder.getSlots()) // folder.getSlots().is("vykonPro:ConnectionFailover").eachValue(function (point) { // console.log(folder.getDisplayName() + " point", point) // $("#ip-auto-append-wrap").append(`
// //
//
`) // sub.subscribe({ // comps: point // }); // }); // }); // }); // }); var single_start = new Date().getTime(); var total = 0; console.log("單一資料夾開始執行", single_start); // baja.Ord.make('local:|foxs:|station:|slot:/BajaScriptExamples/bajatest') // // baja.Ord.make('local:|foxs:|station:|slot:/Arena/H/B') // .get() // .then(function (folder) { // var sub_start = new Date().getTime(); // console.log("進入單一設備資料夾的時間點", sub_start) // console.log("進入單一設備資料夾花費時間", (sub_start - single_start) / 1000 + "sec") // folder.getSlots().is("kitControl:Ramp").eachValue(function (point) { // // folder.getSlots().isComponent().eachValue(function (point) { // // console.log(folder.getDisplayName() + " point", point) // $("#6w-point-auto-append-wrap").append(`
// //
//
`) // sub.subscribe({ // comps: point, // // batch: batch // }); // }); // var sub_end = new Date().getTime(); // console.log("單一設備資料夾所有點位訂閱花費時間", (sub_end - sub_start) / 1000 + "sec") // total += (sub_end - sub_start) / 1000 // console.log("單一設備資料夾當前訂閱總花費時間", total + "sec") // }) // A Promise is an amazing way to handle asynchronous events in JavaScript. For // more information on the Promise library we use, please visit https://github.com/petkaantonov/bluebird. // .promise() // .finally(function () { // Called when the dialog is closed. // Unsubscribe the Component so we're no longer listening to live // events. // sub.unsubscribeAll(); // Detach all subscription handlers to ensure we don't unnecessarily // create memory leaks. // sub.detach(); // }); });