rytm-webflow 2.1.11 → 2.1.12

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.11",
3
+ "version": "2.1.12",
4
4
  "description": "rytm webflow pack - ASwap, ShowUp",
5
5
  "main": "scripts/index.js",
6
6
  "scripts": {
@@ -88,7 +88,14 @@ class ASwap {
88
88
  this.dispatcher.openURL(url, noHistory, useCache);
89
89
  }
90
90
  }
91
-
91
+ /**
92
+ * clear cache
93
+ */
94
+ clearCache(url = null) {
95
+ if (this.dispatcher) {
96
+ this.dispatcher.clearCache(url);
97
+ }
98
+ }
92
99
  onRequestUrl(e) {
93
100
  document.documentElement.classList.add('as-in-progress')
94
101
  this.getActiveControlles().forEach( (c, index)=> {
@@ -58,6 +58,22 @@ class ASwapDispatcher extends EventDispatcher {
58
58
  });
59
59
  return result;
60
60
  }
61
+ clearCache(url = null) {
62
+ if (url) {
63
+ this.clearCacheByUrl(url);
64
+ } else {
65
+ this.ajaxStore = [];
66
+ }
67
+ }
68
+ clearCacheByUrl(url) {
69
+ let newStore = [];
70
+ this.ajaxStore.forEach( (r, index)=> {
71
+ if (r.url !== url) {
72
+ newStore.push(r);
73
+ }
74
+ });
75
+ this.ajaxStore = newStore;
76
+ }
61
77
  /**
62
78
  * parse the result and return content between a tag, eg. <body></body>
63
79
  * @param result {String} the ajax request result