rytm-webflow 2.1.1 → 2.1.2

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": "rytm-webflow",
3
- "version": "2.1.1",
3
+ "version": "2.1.2",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
6
  "scripts": {
@@ -33,6 +33,7 @@ class ASwap {
33
33
  onRequestUrl: () => {},
34
34
  onRequestLoad: () => {},
35
35
  onRequestLoaded: () => {},
36
+ onRequestSameUrl: () => {},
36
37
  onViewHide: () => {},
37
38
  onViewHidden: () => {},
38
39
  onViewSwapStart: () => {},
@@ -63,6 +64,7 @@ class ASwap {
63
64
  this.dispatcher.on(Events.NAV_REQUEST_URL, this.onRequestUrl.bind(this));
64
65
  this.dispatcher.on(Events.NAV_REQUEST_LOAD, this.onRequestLoad.bind(this));
65
66
  this.dispatcher.on(Events.NAV_REQUEST_LOADED, this.onRequestLoaded.bind(this));
67
+ this.dispatcher.on(Events.NAV_REQUEST_SAME_URL, this.onRequestSameUrl.bind(this));
66
68
  this.dispatcher.on(Events.NAV_VIEW_HIDE, this.onViewHide.bind(this));
67
69
  this.dispatcher.on(Events.NAV_VIEW_HIDDEN, this.onViewHidden.bind(this));
68
70
  this.dispatcher.on(Events.NAV_SWAP_START, this.onViewSwapStart.bind(this));
@@ -82,7 +84,7 @@ class ASwap {
82
84
  **/
83
85
  openURL(url, noHistory = false, useCache = true) {
84
86
  if (this.dispatcher) {
85
- this.dispatcher.openURL(url, noHistory, useCache)
87
+ this.dispatcher.openURL(url, noHistory, useCache);
86
88
  }
87
89
  }
88
90
 
@@ -91,7 +93,7 @@ class ASwap {
91
93
  this.getActiveControlles().forEach( (c, index)=> {
92
94
  c.onRequestUrl(e);
93
95
  });
94
- this.events.onRequestUrl()
96
+ this.events.onRequestUrl();
95
97
  }
96
98
  onRequestLoad(e) {
97
99
  document.documentElement.classList.add('js');
@@ -99,14 +101,17 @@ class ASwap {
99
101
  this.getActiveControlles().forEach( (c, index)=> {
100
102
  c.onRequestLoad(e);
101
103
  })
102
- this.events.onRequestLoad()
104
+ this.events.onRequestLoad();
103
105
  }
104
106
  onRequestLoaded(e) {
105
107
  this.getControllersFromContainer(e.target.freshContent).forEach( (c, index)=> {
106
108
  c.onRequestLoaded(e);
107
109
  });
108
110
  document.documentElement.classList.remove("as-request-loading");
109
- this.events.onRequestLoaded()
111
+ this.events.onRequestLoaded();
112
+ }
113
+ onRequestSameUrl(e) {
114
+ this.events.onRequestSameUrl();
110
115
  }
111
116
  onViewHide(e) {
112
117
  document.documentElement.classList.add('as-hide');
@@ -116,7 +121,7 @@ class ASwap {
116
121
  c.onViewHide(e);
117
122
  }
118
123
  });
119
- this.events.onViewHide()
124
+ this.events.onViewHide();
120
125
  }
121
126
  onViewHidden(e) {
122
127
  document.documentElement.classList.remove('as-hide');
@@ -126,26 +131,26 @@ class ASwap {
126
131
  c.onViewHidden(e);
127
132
  }
128
133
  });
129
- this.events.onViewHidden()
134
+ this.events.onViewHidden();
130
135
  }
131
136
  onViewSwapStart(e) {
132
137
  this.getControllersFromContainer(e.target.freshContent).forEach( (c, index)=> {
133
138
  c.onViewSwapStart(e);
134
139
  });
135
- this.events.onViewSwapStart()
140
+ this.events.onViewSwapStart();
136
141
  }
137
142
  onViewSwapComplete(e) {
138
143
  this.getControllersFromContainer(e.target.freshContent).forEach( (c, index)=> {
139
144
  c.onViewSwapComplete(e);
140
145
  });
141
- this.events.onViewSwapComplete()
146
+ this.events.onViewSwapComplete();
142
147
  }
143
148
  onViewShow(e) {
144
149
  document.documentElement.classList.add('as-show');
145
150
  this.getControllersFromContainer(e.target.freshContent).forEach( (c, index)=> {
146
151
  c.onViewShow(e);
147
152
  });
148
- this.events.onViewShow()
153
+ this.events.onViewShow();
149
154
  }
150
155
  onViewShown(e) {
151
156
  document.documentElement.classList.add('as-show');
@@ -310,6 +310,7 @@ class ASwapDispatcher extends EventDispatcher {
310
310
  // check if url changed
311
311
  if (url == this.getCurrentUrl()) {
312
312
  this.trace("url didn't change", url);
313
+ this.dispatch(Events.NAV_REQUEST_SAME_URL);
313
314
  if (this.refreshOnSameUrl) {
314
315
  window.location.href = url;
315
316
  }
@@ -3,6 +3,7 @@ const Events = {
3
3
  NAV_REQUEST_URL: "nav_open_url",
4
4
  NAV_REQUEST_LOAD: "nav_request_load",
5
5
  NAV_REQUEST_LOADED: "nav_request_loaded",
6
+ NAV_REQUEST_SAME_URL: "nav_same_url",
6
7
 
7
8
  // * animation related events: hide / hidden / show / shown
8
9
  NAV_VIEW_HIDE: "nav_veiw_hide",