internet-time
Advanced tools
Comparing version 0.0.10 to 0.0.11
@@ -1,1 +0,1 @@ | ||
const EventEmitter=require("events"),WebSocket=require("isomorphic-ws"),perf=require("./performance"),TimeClient=require("./client"),e=new EventEmitter;let s;const timeClient=new TimeClient({sendRequest:a=>{s.send(a)},createRequest:()=>perf.now()+perf.timeOrigin}),socket=()=>(s||(s=new WebSocket("wss://time-server.fly.dev/"),s.onclose=()=>{s=void 0,socket()},s.onmessage=({data:a})=>{const b=a.split(" "),c=timeClient.processResponse({tTx:+b[0],tServer:+(b[1]/1e3)});e.emit("delta",c)},s.onopen=()=>timeClient.start()),s);e.delta=()=>(socket(),timeClient.getDelta()||0),e.now=()=>perf.timeOrigin+perf.now()+e.delta(),e.nextDelta=()=>new Promise(a=>{e.now(),e.once("delta",a)}),module.exports=e; | ||
const EventEmitter=require("events"),WebSocket=require("isomorphic-ws"),perf=require("./performance"),TimeClient=require("./client"),e=new EventEmitter;let s;const timeClient=new TimeClient({sendRequest:a=>{try{s.send(a)}catch(a){}},createRequest:()=>perf.now()+perf.timeOrigin}),socket=()=>(s||(s=new WebSocket("wss://time-server.fly.dev/"),s=new WebSocket("ws://localhost:8081/"),s.onclose=()=>{s=void 0,socket()},s.onmessage=({data:a})=>{const b=a.split(" "),c=timeClient.processResponse({tTx:+b[0],tServer:+(b[1]/1e3)});e.emit("delta",c)},s.onerror=()=>{},s.onopen=()=>timeClient.start()),s);e.delta=()=>(socket(),timeClient.getDelta()||0),e.now=()=>perf.timeOrigin+perf.now()+e.delta(),e.nextDelta=()=>new Promise(a=>{e.now(),e.once("delta",a)}),module.exports=e; |
{ | ||
"name": "internet-time", | ||
"version": "0.0.10", | ||
"version": "0.0.11", | ||
"main": "dist/index.js", | ||
@@ -5,0 +5,0 @@ "license": "MIT", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2782