Se agrega funcionalidad de WebSockets
This commit is contained in:
@ -12,3 +12,38 @@ function readyDate(date) {
|
||||
+ ':' + date.getMinutes()
|
||||
+ ':' + date.getSeconds()
|
||||
}
|
||||
|
||||
let socket = {
|
||||
url: '',
|
||||
conn: null,
|
||||
connect: function(ready, getMessage) {
|
||||
this.conn = new WebSocket(this.url)
|
||||
this.conn.onopen = (e) => {
|
||||
console.debug(e)
|
||||
ready()
|
||||
}
|
||||
this.conn.onmessage = (e) => {
|
||||
console.debug(e)
|
||||
getMessage(e)
|
||||
}
|
||||
this.conn.onerror = (e) => {
|
||||
console.error(e)
|
||||
}
|
||||
this.conn.onclose = (e) => {
|
||||
if (e.code != 1000) {
|
||||
console.error(e)
|
||||
return
|
||||
}
|
||||
console.debug(e)
|
||||
}
|
||||
},
|
||||
sendMessage: function(action, data = null) {
|
||||
var msg = {
|
||||
action: action
|
||||
}
|
||||
if (data != null) {
|
||||
msg['data'] = data
|
||||
}
|
||||
this.conn.send(JSON.stringify(msg))
|
||||
}
|
||||
}
|
||||
|
2
ui/public/assets/scripts/main.min.js
vendored
2
ui/public/assets/scripts/main.min.js
vendored
@ -1,2 +1,2 @@
|
||||
"use strict";function formatValue(t,e){return new Intl.NumberFormat("es-CL",{style:"currency",currency:e,minimumSignificantDigits:2}).format(t)}function formatDate(t){return new Intl.DateTimeFormat("es-CL",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(t)}function readyDate(t){return t.getFullYear()+"-"+(t.getMonth()+1)+"-"+t.getDate()+" "+t.getHours()+":"+t.getMinutes()+":"+t.getSeconds()}
|
||||
"use strict";function formatValue(n,e){return new Intl.NumberFormat("es-CL",{style:"currency",currency:e,minimumSignificantDigits:2}).format(n)}function formatDate(n){return new Intl.DateTimeFormat("es-CL",{year:"numeric",month:"2-digit",day:"2-digit",hour:"2-digit",minute:"2-digit",second:"2-digit"}).format(n)}function readyDate(n){return n.getFullYear()+"-"+(n.getMonth()+1)+"-"+n.getDate()+" "+n.getHours()+":"+n.getMinutes()+":"+n.getSeconds()}var socket={url:"",conn:null,connect:function(e,t){this.conn=new WebSocket(this.url),this.conn.onopen=function(n){console.debug(n),e()},this.conn.onmessage=function(n){console.debug(n),t(n)},this.conn.onerror=function(n){console.error(n)},this.conn.onclose=function(n){1e3==n.code?console.debug(n):console.error(n)}},sendMessage:function(n){var e=1<arguments.length&&void 0!==arguments[1]?arguments[1]:null,n={action:n};null!=e&&(n.data=e),this.conn.send(JSON.stringify(n))}};
|
||||
//# sourceMappingURL=maps/main.min.js.map
|
||||
|
@ -1 +1 @@
|
||||
{"version":3,"file":"../main.min.js","sources":["main.js"],"sourcesContent":["\"use strict\";\n\nfunction formatValue(value, base) {\n return new Intl.NumberFormat('es-CL', {\n style: 'currency',\n currency: base,\n minimumSignificantDigits: 2\n }).format(value);\n}\n\nfunction formatDate(date) {\n return new Intl.DateTimeFormat('es-CL', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n }).format(date);\n}\n\nfunction readyDate(date) {\n return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();\n}"],"names":["formatValue","value","base","Intl","NumberFormat","style","currency","minimumSignificantDigits","format","formatDate","date","DateTimeFormat","year","month","day","hour","minute","second","readyDate","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds"],"mappings":"aAEA,SAASA,YAAYC,EAAOC,GAC1B,OAAO,IAAIC,KAAKC,aAAa,QAAS,CACpCC,MAAO,WACPC,SAAUJ,EACVK,yBAA0B,IACzBC,OAAOP,GAGZ,SAASQ,WAAWC,GAClB,OAAO,IAAIP,KAAKQ,eAAe,QAAS,CACtCC,KAAM,UACNC,MAAO,UACPC,IAAK,UACLC,KAAM,UACNC,OAAQ,UACRC,OAAQ,YACPT,OAAOE,GAGZ,SAASQ,UAAUR,GACjB,OAAOA,EAAKS,cAAgB,KAAOT,EAAKU,WAAa,GAAK,IAAMV,EAAKW,UAAY,IAAMX,EAAKY,WAAa,IAAMZ,EAAKa,aAAe,IAAMb,EAAKc"}
|
||||
{"version":3,"file":"../main.min.js","sources":["main.js"],"sourcesContent":["\"use strict\";\n\nfunction formatValue(value, base) {\n return new Intl.NumberFormat('es-CL', {\n style: 'currency',\n currency: base,\n minimumSignificantDigits: 2\n }).format(value);\n}\n\nfunction formatDate(date) {\n return new Intl.DateTimeFormat('es-CL', {\n year: 'numeric',\n month: '2-digit',\n day: '2-digit',\n hour: '2-digit',\n minute: '2-digit',\n second: '2-digit'\n }).format(date);\n}\n\nfunction readyDate(date) {\n return date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate() + ' ' + date.getHours() + ':' + date.getMinutes() + ':' + date.getSeconds();\n}\n\nvar socket = {\n url: '',\n conn: null,\n connect: function connect(ready, getMessage) {\n this.conn = new WebSocket(this.url);\n\n this.conn.onopen = function (e) {\n console.debug(e);\n ready();\n };\n\n this.conn.onmessage = function (e) {\n console.debug(e);\n getMessage(e);\n };\n\n this.conn.onerror = function (e) {\n console.error(e);\n };\n\n this.conn.onclose = function (e) {\n if (e.code != 1000) {\n console.error(e);\n return;\n }\n\n console.debug(e);\n };\n },\n sendMessage: function sendMessage(action) {\n var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null;\n var msg = {\n action: action\n };\n\n if (data != null) {\n msg['data'] = data;\n }\n\n this.conn.send(JSON.stringify(msg));\n }\n};"],"names":["formatValue","value","base","Intl","NumberFormat","style","currency","minimumSignificantDigits","format","formatDate","date","DateTimeFormat","year","month","day","hour","minute","second","readyDate","getFullYear","getMonth","getDate","getHours","getMinutes","getSeconds","socket","url","conn","connect","ready","getMessage","this","WebSocket","onopen","e","console","debug","onmessage","onerror","error","onclose","code","sendMessage","action","data","arguments","length","undefined","msg","send","JSON","stringify"],"mappings":"aAEA,SAASA,YAAYC,EAAOC,GAC1B,OAAO,IAAIC,KAAKC,aAAa,QAAS,CACpCC,MAAO,WACPC,SAAUJ,EACVK,yBAA0B,IACzBC,OAAOP,GAGZ,SAASQ,WAAWC,GAClB,OAAO,IAAIP,KAAKQ,eAAe,QAAS,CACtCC,KAAM,UACNC,MAAO,UACPC,IAAK,UACLC,KAAM,UACNC,OAAQ,UACRC,OAAQ,YACPT,OAAOE,GAGZ,SAASQ,UAAUR,GACjB,OAAOA,EAAKS,cAAgB,KAAOT,EAAKU,WAAa,GAAK,IAAMV,EAAKW,UAAY,IAAMX,EAAKY,WAAa,IAAMZ,EAAKa,aAAe,IAAMb,EAAKc,aAGhJ,IAAIC,OAAS,CACXC,IAAK,GACLC,KAAM,KACNC,QAAS,SAAiBC,EAAOC,GAC/BC,KAAKJ,KAAO,IAAIK,UAAUD,KAAKL,KAE/BK,KAAKJ,KAAKM,OAAS,SAAUC,GAC3BC,QAAQC,MAAMF,GACdL,KAGFE,KAAKJ,KAAKU,UAAY,SAAUH,GAC9BC,QAAQC,MAAMF,GACdJ,EAAWI,IAGbH,KAAKJ,KAAKW,QAAU,SAAUJ,GAC5BC,QAAQI,MAAML,IAGhBH,KAAKJ,KAAKa,QAAU,SAAUN,GACd,KAAVA,EAAEO,KAKNN,QAAQC,MAAMF,GAJZC,QAAQI,MAAML,KAOpBQ,YAAa,SAAqBC,GAChC,IAAIC,EAA0B,EAAnBC,UAAUC,aAA+BC,IAAjBF,UAAU,GAAmBA,UAAU,GAAK,KAC3EG,EAAM,CACRL,OAAQA,GAGE,MAARC,IACFI,EAAU,KAAIJ,GAGhBb,KAAKJ,KAAKsB,KAAKC,KAAKC,UAAUH"}
|
Reference in New Issue
Block a user