rytm-webflow 2.1.10 → 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
package/scripts/aswap/ASwap.js
CHANGED
|
@@ -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
|
|
@@ -399,10 +415,10 @@ class ASwapDispatcher extends EventDispatcher {
|
|
|
399
415
|
* ### Event handlers ###
|
|
400
416
|
*/
|
|
401
417
|
onDocumentClick(e) {
|
|
402
|
-
|
|
418
|
+
const a = e.target.closest('a');
|
|
419
|
+
if (!a) {
|
|
403
420
|
return;
|
|
404
421
|
}
|
|
405
|
-
const a = e.target
|
|
406
422
|
if (this.isLinkElementValid(a) && !e.metaKey & !e.ctrlKey) {
|
|
407
423
|
const useCache = !a.classList.contains(this.noCacheClassName);
|
|
408
424
|
const url = a.getAttribute("href");
|