status-tap-f1acefac.js 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. /*!
  2. * (C) Ionic http://ionicframework.com - MIT License
  3. */
  4. 'use strict';
  5. const index = require('./index-2e236a04.js');
  6. const index$1 = require('./index-31b07b9c.js');
  7. const helpers = require('./helpers-8a48fdea.js');
  8. require('./index-cc858e97.js');
  9. const startStatusTap = () => {
  10. const win = window;
  11. win.addEventListener('statusTap', () => {
  12. index.readTask(() => {
  13. const width = win.innerWidth;
  14. const height = win.innerHeight;
  15. const el = document.elementFromPoint(width / 2, height / 2);
  16. if (!el) {
  17. return;
  18. }
  19. const contentEl = index$1.findClosestIonContent(el);
  20. if (contentEl) {
  21. new Promise((resolve) => helpers.componentOnReady(contentEl, resolve)).then(() => {
  22. index.writeTask(async () => {
  23. /**
  24. * If scrolling and user taps status bar,
  25. * only calling scrollToTop is not enough
  26. * as engines like WebKit will jump the
  27. * scroll position back down and complete
  28. * any in-progress momentum scrolling.
  29. */
  30. contentEl.style.setProperty('--overflow', 'hidden');
  31. await index$1.scrollToTop(contentEl, 300);
  32. contentEl.style.removeProperty('--overflow');
  33. });
  34. });
  35. }
  36. });
  37. });
  38. };
  39. exports.startStatusTap = startStatusTap;