main.js 1019 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. // main
  2. document.addEventListener("DOMContentLoaded", function(event) {
  3. let conn = new Conn(addr, {
  4. incoming: function(mes) {
  5. let data = mes.data()
  6. console.log('incoming', data)
  7. },
  8. connected: function() {
  9. console.log('connected')
  10. // interface can be enabled
  11. conn.sendMessage({
  12. 'command': 'method',
  13. 'random_num': "1000000",
  14. }, function(rData) {
  15. console.log('method', rData)
  16. })
  17. }
  18. })
  19. /*
  20. let api = new API(addr)
  21. api.curveInit(
  22. "2",
  23. "4",
  24. "10000",
  25. function(data) {
  26. console.log('curve-init', data)
  27. }
  28. )
  29. api.curves()
  30. */
  31. window.onbeforeunload = function(e) {
  32. var message = "Закрыть программу?";
  33. if (typeof e == "undefined") {
  34. e = window.event;
  35. }
  36. if (e) {
  37. e.returnValue = message;
  38. }
  39. return message;
  40. }
  41. });