DigitMagazine

Devworx_Nov2017_CoinHive events and handlers

Oct 24th, 2017
224
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.41 KB | None | 0 0
  1. <script>
  2. // Listen on events
  3. miner.on('found', function() { /* Hash found */ })
  4. miner.on('accepted', function() { /* Hash accepted by the pool */ })
  5.  
  6. // Update stats once per second
  7. setInterval(function() {
  8. var hashesPerSecond = miner.getHashesPerSecond();
  9. var totalHashes = miner.getTotalHashes();
  10. var acceptedHashes = miner.getAcceptedHashes();
  11.  
  12. // Output to HTML elements...
  13. }, 1000);
  14. </script>
Add Comment
Please, Sign In to add comment