Skip to content

Commit

Permalink
Merge pull request #518 from CodeByZach/514
Browse files Browse the repository at this point in the history
Fixing some Ajax calls not completing
  • Loading branch information
CodeByZach authored Mar 3, 2021
2 parents 44c3a15 + 5ba323c commit f791042
Show file tree
Hide file tree
Showing 6 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion pace-theme-default.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* pace.js v1.2.3 | Default theme
* pace.js v1.2.4 | Default theme
* https://github.com/CodeByZach/pace/
* Licensed MIT © HubSpot, Inc.
*/
Expand Down
2 changes: 1 addition & 1 deletion pace-theme-default.min.css
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* pace.js v1.2.3 | Default theme
* pace.js v1.2.4 | Default theme
* https://github.com/CodeByZach/pace/
* Licensed MIT © HubSpot, Inc.
*/
Expand Down
22 changes: 20 additions & 2 deletions pace.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*!
* pace.js v1.2.3
* pace.js v1.2.4
* https://github.com/CodeByZach/pace/
* Licensed MIT © HubSpot, Inc.
*/
Expand Down Expand Up @@ -49,7 +49,25 @@
cancelAnimationFrame = window.cancelAnimationFrame || window.mozCancelAnimationFrame;

addEventListener = function(obj, event, callback) {
return (typeof obj.addEventListener === "function" ? obj.addEventListener(event, callback, false) : void 0) || (obj["on" + event] = callback);
if (typeof obj.addEventListener === "function") {
return obj.addEventListener(event, callback, false);
} else {
return function() {
if (typeof obj["on" + event] !== "function" || typeof obj["on" + event].eventListeners !== "object") {
var eventListeners = new Events();
if (typeof obj["on" + event] === "function") {
eventListeners.on(event, obj["on" + event]);
}
obj["on" + event] = function(evt) {
return eventListeners.trigger(event, evt);
};
obj["on" + event].eventListeners = eventListeners;
} else {
var eventListeners = obj["on" + event].eventListeners;
}
eventListeners.on(event, callback);
}();
}
};

if (requestAnimationFrame == null) {
Expand Down
4 changes: 2 additions & 2 deletions pace.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "pace-js",
"version": "1.2.3",
"version": "1.2.4",
"description": "Automatically add a progress bar to your site.",
"main": "pace.js",
"scripts": {
Expand Down

0 comments on commit f791042

Please sign in to comment.