2
0

mousebutton.js 647 B

123456789101112131415161718192021222324252627
  1. /*
  2. * Copyright 2018 Scytl Secure Electronic Voting SA
  3. *
  4. * All rights reserved
  5. *
  6. * See our extended copyright notice in *file 'Copyright.txt' which is part of this source code package
  7. */
  8. /* jshint node:true */
  9. 'use strict';
  10. module.exports = MouseButtonCollector;
  11. var collectEntropy_;
  12. function MouseButtonCollector(collectEntropyCallback) {
  13. collectEntropy_ = collectEntropyCallback;
  14. }
  15. MouseButtonCollector.prototype = {
  16. handleEvent: function(ev) {
  17. ev = ev || window.event;
  18. collectEntropy_(
  19. (ev.x || ev.clientX || ev.offsetX || 0) +
  20. (ev.y || ev.clientY || ev.offsetY || 0) + (+new Date()),
  21. 3);
  22. }
  23. };