daily pastebin goal
42%
SHARE
TWEET

Untitled

Bocci94 Jan 18th, 2019 60 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1.  var fio2 = 0;
  2.     var timeout;
  3.     var sec = 30;
  4.  
  5.     startEvent = function() {
  6.      
  7.       var ws = new WebSocket("ws://127.0.0.1:5678/");
  8.  
  9.       ws.onmessage = function (event) {
  10.       obj = JSON.parse(event.data);
  11.       fio2 = parseFloat(obj.type.Ossimetro.property.O2);
  12.       }
  13.      
  14.  
  15.       console.log("FIO2 ORIGINALE: ", fio2);
  16.  
  17.       if (fio2< 90){        
  18.         console.log("secondifio2: ",sec)
  19.         timeout = setInterval(AllarmFunction(sec),1000)        
  20.       }
  21.       else {
  22.         sec = 30;        
  23.       }
  24.  
  25.     };
  26.   }
  27.  
  28.   AllarmFunction = function(secondi){
  29.     sec--;
  30.     console.log("sec: ",secondi)
  31.     if (secondi == 0)
  32.   console.log("PROBLEMA")
  33. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top