UNPKG

timesync

Version:

Time synchronization between peers

47 lines (39 loc) 1.07 kB
<!DOCTYPE html> <html> <head> <title>peer3</title> <!-- include es5-shim and es5-shim when support for older browsers is needed --> <script src="https://cdnjs.cloudflare.com/ajax/libs/es5-shim/4.0.5/es5-shim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.23.0/es6-shim.min.js"></script> <script src="https://cdnjs.cloudflare.com/ajax/libs/peerjs/0.3.14/peer.min.js"></script> <script src="../../../dist/timesync.js"></script> <script src="client.js"></script> <style> body { font-family: sans-serif; } table th { text-align: left; } </style> </head> <body> <h2>peer3</h2> <p> Synchronizes with peer1 and peer2. </p> <table> <tr><th>System time</th><td id="systemTime"></td></tr> <tr><th>Synchronized time</th><td id="syncTime"></td></tr> <tr><th>Offset</th><td id="offset"></td></tr> </table> <p id="syncing"></p> <script> var id = 'peer3'; var peers = ['peer1', 'peer2']; var obj = connect(id, peers); var peer = obj.peer; var ts = obj.ts; </script> </body> </html>