@glitchr/transparent 1.0.53 → 1.0.54

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": "@glitchr/transparent",
3
- "version": "1.0.53",
3
+ "version": "1.0.54",
4
4
  "description": "Transparent SPA Application",
5
5
  "main": "src/index.js",
6
6
  "access": "public",
File without changes
@@ -1431,6 +1431,7 @@
1431
1431
  return elementsXY;
1432
1432
  }
1433
1433
 
1434
+ var ajaxSemaphore = false;
1434
1435
  var formSubmission = false;
1435
1436
  function __main__(e) {
1436
1437
 
@@ -1489,7 +1490,7 @@
1489
1490
  if ($(e.target).hasClass(Transparent.state.RELOAD)) return;
1490
1491
  if ($(form).hasClass(Transparent.state.RELOAD)) return;
1491
1492
 
1492
- if(e.type == "submit")
1493
+ if(e.type == "submit") // NB: This doesn't work if a button is generated afterward..
1493
1494
  $(form).find(':submit').attr('disabled', 'disabled');
1494
1495
  }
1495
1496
 
@@ -1511,6 +1512,7 @@
1511
1512
 
1512
1513
  e.preventDefault();
1513
1514
 
1515
+ if (ajaxSemaphore) return;
1514
1516
  if (url == location) return;
1515
1517
 
1516
1518
  if((e.type == Transparent.state.CLICK || e.type == Transparent.state.HASHCHANGE) && url.pathname == location.pathname && url.search == location.search && type != "POST") {
@@ -1546,6 +1548,8 @@
1546
1548
 
1547
1549
  function handleResponse(uuid, status = 200, method = null, data = null, xhr = null, request = null) {
1548
1550
 
1551
+ ajaxSemaphore = false;
1552
+
1549
1553
  var responseURL;
1550
1554
  responseURL = xhr !== null ? xhr.responseURL : url.href;
1551
1555
 
@@ -1587,6 +1591,7 @@
1587
1591
  }
1588
1592
 
1589
1593
  if(form) {
1594
+
1590
1595
  $(form).find(':submit').removeAttr('disabled');
1591
1596
  form.reset();
1592
1597
  }
@@ -1697,6 +1702,8 @@
1697
1702
  // Submit ajax request..
1698
1703
  if(form) form.dispatchEvent(new SubmitEvent("submit", { submitter: formTrigger }));
1699
1704
  var xhr = new XMLHttpRequest();
1705
+
1706
+ ajaxSemaphore = true;
1700
1707
  return jQuery.ajax({
1701
1708
  url: url.href,
1702
1709
  type: type,