Skip to content

Instantly share code, notes, and snippets.

View rothlis's full-sized avatar
🚀
Founding a startup

Sebastien Rothlisberger rothlis

🚀
Founding a startup
View GitHub Profile
@rothlis
rothlis / duplicate-requests.decorator.js
Last active December 29, 2017 19:26
AngularJS decorator to prevent identical request
const $duplicateRequestDecorator = ($delegate, $q) => {
const pendingRequestPromises = {}
function $http(config) {
if (config.ignoreDuplicateRequest) {
return $delegate(config)
}
let identifier = getRequestIdentifier(config)