@brandocms/jupiter 3.48.3 → 3.48.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brandocms/jupiter",
3
- "version": "3.48.3",
3
+ "version": "3.48.4",
4
4
  "description": "Frontend helpers.",
5
5
  "author": "Univers/Twined",
6
6
  "license": "UNLICENSED",
@@ -107,6 +107,10 @@ export default class Application {
107
107
  left: 0
108
108
  }
109
109
 
110
+ this.state = {
111
+ revealed: false
112
+ }
113
+
110
114
  this.opts = _defaultsDeep(opts, DEFAULT_OPTIONS)
111
115
  this.focusableSelectors = this.opts.focusableSelectors
112
116
 
@@ -487,6 +491,7 @@ export default class Application {
487
491
 
488
492
  _emitRevealedEvent() {
489
493
  if (!document.body.hasAttribute('data-app-revealed')) {
494
+ this.state.revealed = true
490
495
  document.body.dataset.appRevealed = true
491
496
  window.dispatchEvent(this.revealedEvent)
492
497
  this.executeCallbacks(Events.APPLICATION_REVEALED)
@@ -27,9 +27,13 @@ export default class Lazyload {
27
27
  this.initialize()
28
28
 
29
29
  if (this.opts.registerCallback) {
30
- this.app.registerCallback(Events.APPLICATION_REVEALED, () => {
30
+ if (this.app.state.revealed) {
31
31
  this.watch()
32
- })
32
+ } else {
33
+ this.app.registerCallback(Events.APPLICATION_REVEALED, () => {
34
+ this.watch()
35
+ })
36
+ }
33
37
  }
34
38
  }
35
39