@very-simple/ajax 0.7.0 → 0.7.1
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/dist/index.js +7 -4
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -34,7 +34,7 @@ var load = async (url, regions, options) => {
|
|
|
34
34
|
});
|
|
35
35
|
const html = await response.text();
|
|
36
36
|
const document2 = parser.parseFromString(html, "text/html");
|
|
37
|
-
return { document: document2,
|
|
37
|
+
return { document: document2, response };
|
|
38
38
|
} catch (e) {
|
|
39
39
|
setProgress(0);
|
|
40
40
|
const isAbortError = e instanceof DOMException && e.name === "AbortError";
|
|
@@ -150,8 +150,6 @@ var visit = async (url, {
|
|
|
150
150
|
request,
|
|
151
151
|
regions = []
|
|
152
152
|
} = {}) => {
|
|
153
|
-
prevUrl = currentUrl;
|
|
154
|
-
currentUrl = url;
|
|
155
153
|
if (emitEvents) emit("before-visit", { url, prevUrl });
|
|
156
154
|
let newDocument;
|
|
157
155
|
if (isBackForward) {
|
|
@@ -160,9 +158,14 @@ var visit = async (url, {
|
|
|
160
158
|
if (!newDocument) {
|
|
161
159
|
const options = { loadingDelay, progressHideDelay, request };
|
|
162
160
|
const result = await load(url, regions, options);
|
|
163
|
-
if (result)
|
|
161
|
+
if (result) {
|
|
162
|
+
newDocument = result.document;
|
|
163
|
+
url = result.response.redirected ? result.response.url : url;
|
|
164
|
+
}
|
|
164
165
|
}
|
|
165
166
|
if (!newDocument) return;
|
|
167
|
+
prevUrl = currentUrl;
|
|
168
|
+
currentUrl = url;
|
|
166
169
|
if (emitEvents) emit("before-render", { url, prevUrl, newDocument });
|
|
167
170
|
if (!isBackForward) {
|
|
168
171
|
const cacheId = window.location.pathname + window.location.search;
|