a zip code crypto-currency system good for red ONLY

ui-event-manager.js 2.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. (function (factory) {
  2. if (typeof module === "object" && typeof module.exports === "object") {
  3. var v = factory(require, exports);
  4. if (v !== undefined) module.exports = v;
  5. }
  6. else if (typeof define === "function" && define.amd) {
  7. define(["require", "exports", "./pointer-events"], factory);
  8. }
  9. })(function (require, exports) {
  10. "use strict";
  11. Object.defineProperty(exports, "__esModule", { value: true });
  12. var pointer_events_1 = require("./pointer-events");
  13. /**
  14. * @hidden
  15. */
  16. var UIEventManager = (function () {
  17. function UIEventManager(plt) {
  18. this.plt = plt;
  19. this.evts = [];
  20. }
  21. UIEventManager.prototype.pointerEvents = function (config) {
  22. if (!config.element || !config.pointerDown) {
  23. console.error('PointerEvents config is invalid');
  24. return;
  25. }
  26. var eventListnerOpts = {
  27. capture: config.capture,
  28. passive: config.passive,
  29. zone: config.zone
  30. };
  31. var pointerEvents = new pointer_events_1.PointerEvents(this.plt, config.element, config.pointerDown, config.pointerMove, config.pointerUp, eventListnerOpts);
  32. var removeFunc = function () { return pointerEvents.destroy(); };
  33. this.evts.push(removeFunc);
  34. return pointerEvents;
  35. };
  36. UIEventManager.prototype.listen = function (ele, eventName, callback, opts) {
  37. if (ele) {
  38. var removeFunc = this.plt.registerListener(ele, eventName, callback, opts);
  39. this.evts.push(removeFunc);
  40. return removeFunc;
  41. }
  42. };
  43. UIEventManager.prototype.unlistenAll = function () {
  44. this.evts.forEach(function (unRegEvent) {
  45. unRegEvent();
  46. });
  47. this.evts.length = 0;
  48. };
  49. UIEventManager.prototype.destroy = function () {
  50. this.unlistenAll();
  51. this.evts = null;
  52. };
  53. return UIEventManager;
  54. }());
  55. exports.UIEventManager = UIEventManager;
  56. });
  57. //# sourceMappingURL=ui-event-manager.js.map