// main document.addEventListener("DOMContentLoaded", function(event) { let conn = new Conn(addr, { incoming: function(mes) { let data = mes.data() console.log('incoming', data) }, connected: function() { console.log('connected') // interface can be enabled conn.sendMessage({ 'command': 'method', 'random_num': "1000000", }, function(rData) { console.log('method', rData) }) } }) /* let api = new API(addr) api.curveInit( "2", "4", "10000", function(data) { console.log('curve-init', data) } ) api.curves() */ window.onbeforeunload = function(e) { var message = "Закрыть программу?"; if (typeof e == "undefined") { e = window.event; } if (e) { e.returnValue = message; } return message; } });