modularload
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -92,5 +92,5 @@ 'use strict'; | ||
this.isInserted = false; | ||
this.isLoading = false; | ||
this.enterTimeout = false; | ||
this.controller = new AbortController(); | ||
this.signal = this.controller.signal; | ||
this.enterTimeout = false; | ||
this.classContainer = this.html; | ||
@@ -141,3 +141,8 @@ this.isChrome = navigator.userAgent.indexOf("Chrome") != -1 ? true : false; | ||
value: function reset() { | ||
this.controller.abort(); | ||
if (this.isLoading) { | ||
this.controller.abort(); | ||
this.isLoading = false; | ||
this.controller = new AbortController(); | ||
} | ||
window.clearTimeout(this.enterTimeout); | ||
@@ -223,3 +228,3 @@ | ||
if (this.isUrl != null && this.isUrl != 'false') { | ||
if (this.isUrl != null && this.isUrl != 'false' && this.isUrl != false) { | ||
history.pushState(this.transition, null, href); | ||
@@ -269,4 +274,6 @@ } else { | ||
this.isLoading = true; | ||
var signal = this.controller.signal; | ||
fetch(href, { | ||
signal: this.signal | ||
signal: signal | ||
}).then(function (response) { | ||
@@ -298,4 +305,6 @@ return response.text(); | ||
_this3.loadEls(_this3.newContainer); | ||
}); | ||
_this3.isLoading = false; | ||
}).catch(function (err) {}); | ||
if (push) { | ||
@@ -302,0 +311,0 @@ history.pushState(this.transition, null, href); |
@@ -90,5 +90,5 @@ function _classCallCheck(instance, Constructor) { | ||
this.isInserted = false; | ||
this.isLoading = false; | ||
this.enterTimeout = false; | ||
this.controller = new AbortController(); | ||
this.signal = this.controller.signal; | ||
this.enterTimeout = false; | ||
this.classContainer = this.html; | ||
@@ -139,3 +139,8 @@ this.isChrome = navigator.userAgent.indexOf("Chrome") != -1 ? true : false; | ||
value: function reset() { | ||
this.controller.abort(); | ||
if (this.isLoading) { | ||
this.controller.abort(); | ||
this.isLoading = false; | ||
this.controller = new AbortController(); | ||
} | ||
window.clearTimeout(this.enterTimeout); | ||
@@ -221,3 +226,3 @@ | ||
if (this.isUrl != null && this.isUrl != 'false') { | ||
if (this.isUrl != null && this.isUrl != 'false' && this.isUrl != false) { | ||
history.pushState(this.transition, null, href); | ||
@@ -267,4 +272,6 @@ } else { | ||
this.isLoading = true; | ||
var signal = this.controller.signal; | ||
fetch(href, { | ||
signal: this.signal | ||
signal: signal | ||
}).then(function (response) { | ||
@@ -296,4 +303,6 @@ return response.text(); | ||
_this3.loadEls(_this3.newContainer); | ||
}); | ||
_this3.isLoading = false; | ||
}).catch(function (err) {}); | ||
if (push) { | ||
@@ -300,0 +309,0 @@ history.pushState(this.transition, null, href); |
{ | ||
"name": "modularload", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "Dead simple page transitions and lazy loading.", | ||
@@ -5,0 +5,0 @@ "repository": "modularorg/modularload", |
@@ -28,5 +28,5 @@ export default class { | ||
this.isInserted = false; | ||
this.isLoading = false; | ||
this.enterTimeout = false; | ||
this.controller = new AbortController(); | ||
this.signal = this.controller.signal; | ||
this.enterTimeout = false; | ||
@@ -71,3 +71,8 @@ this.classContainer = this.html; | ||
reset() { | ||
this.controller.abort(); | ||
if (this.isLoading) { | ||
this.controller.abort(); | ||
this.isLoading = false; | ||
this.controller = new AbortController(); | ||
} | ||
window.clearTimeout(this.enterTimeout); | ||
@@ -152,3 +157,3 @@ | ||
if (this.isUrl != null && this.isUrl != 'false') { | ||
if (this.isUrl != null && this.isUrl != 'false' && this.isUrl != false) { | ||
history.pushState(this.transition, null, href); | ||
@@ -192,5 +197,6 @@ } else { | ||
goTo(href, container, push) { | ||
fetch(href, { | ||
signal: this.signal | ||
}) | ||
this.isLoading = true; | ||
const signal = this.controller.signal; | ||
fetch(href, {signal}) | ||
.then(response => response.text()) | ||
@@ -219,4 +225,8 @@ .then(data => { | ||
this.loadEls(this.newContainer); | ||
this.isLoading = false; | ||
}) | ||
.catch(err => { | ||
}) | ||
if (push) { | ||
@@ -223,0 +233,0 @@ history.pushState(this.transition, null, href); |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
44832
1126