Skip to content

Commit

Permalink
Use more modern event listener format, 3.5.9
Browse files Browse the repository at this point in the history
  • Loading branch information
caseywebdev committed Jun 27, 2022
1 parent d0075c2 commit eb4f9dc
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 27 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "cogs-transformer-concat-commonjs",
"version": "3.5.8",
"version": "3.5.9",
"author": "Casey Foster <c@sey.me>",
"description": "A CommonJS concatenation transformer for Cogs.",
"license": "MIT",
Expand Down
26 changes: 13 additions & 13 deletions resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var Cogs = (function () {
delete module.factory;
try {
factory(require, require.async, module, module.exports);
} catch (er) {
} catch (error) {
module.factory = factory;
throw er;
throw error;
}
}

Expand All @@ -38,20 +38,20 @@ var Cogs = (function () {
var script = document.createElement('script');
script.async = true;
script.src = src;
script.onload = function () {
script.addEventListener('load', function () {
try {
resolve();
} catch (er) {
reject(er);
} catch (error) {
reject(error);
}
};
script.onerror = function () {
reject(new Error("Cannot load '" + src + "'"));
};
});
script.addEventListener('error', function (event) {
reject(event.error);
});
document.head.appendChild(script);
}).catch(function (er) {
}).catch(function (error) {
delete fetches[src];
throw er;
throw error;
}))
);
};
Expand All @@ -69,9 +69,9 @@ var Cogs = (function () {
return resolve(require(path));
})
.catch(reject);
}).catch(function (er) {
}).catch(function (error) {
delete modulePromises[path];
throw er;
throw error;
}))
);
};
Expand Down
26 changes: 13 additions & 13 deletions test/output.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ var Cogs = (function () {
delete module.factory;
try {
factory(require, require.async, module, module.exports);
} catch (er) {
} catch (error) {
module.factory = factory;
throw er;
throw error;
}
}

Expand All @@ -38,20 +38,20 @@ var Cogs = (function () {
var script = document.createElement('script');
script.async = true;
script.src = src;
script.onload = function () {
script.addEventListener('load', function () {
try {
resolve();
} catch (er) {
reject(er);
} catch (error) {
reject(error);
}
};
script.onerror = function () {
reject(new Error("Cannot load '" + src + "'"));
};
});
script.addEventListener('error', function (event) {
reject(event.error);
});
document.head.appendChild(script);
}).catch(function (er) {
}).catch(function (error) {
delete fetches[src];
throw er;
throw error;
}))
);
};
Expand All @@ -69,9 +69,9 @@ var Cogs = (function () {
return resolve(require(path));
})
.catch(reject);
}).catch(function (er) {
}).catch(function (error) {
delete modulePromises[path];
throw er;
throw error;
}))
);
};
Expand Down

0 comments on commit eb4f9dc

Please sign in to comment.