Skip to content

Commit 3e16042

Browse files
committed
Fixed loop.
1 parent 62b00d5 commit 3e16042

File tree

3 files changed

+23
-19
lines changed

3 files changed

+23
-19
lines changed

dist/js-data-angular.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -121,15 +121,17 @@
121121

122122
for (i = 0; i < functionsToWrap.length; i++) {
123123
originals[functionsToWrap[i]] = store[functionsToWrap[i]];
124-
store[functionsToWrap[i]] = function () {
125-
var args = arguments;
126-
if (!$rootScope.$$phase) {
127-
return $rootScope.$apply(function () {
128-
return originals[functionsToWrap[i]].apply(store, args);
129-
});
130-
}
131-
return originals[functionsToWrap[i]].apply(store, args);
132-
};
124+
store[functionsToWrap[i]] = (function (name) {
125+
return function () {
126+
var args = arguments;
127+
if (!$rootScope.$$phase) {
128+
return $rootScope.$apply(function () {
129+
return originals[name].apply(store, args);
130+
});
131+
}
132+
return originals[name].apply(store, args);
133+
};
134+
})(functionsToWrap[i]);
133135
}
134136

135137
return store;

dist/js-data-angular.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/index.js

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -111,15 +111,17 @@
111111

112112
for (i = 0; i < functionsToWrap.length; i++) {
113113
originals[functionsToWrap[i]] = store[functionsToWrap[i]];
114-
store[functionsToWrap[i]] = function () {
115-
var args = arguments;
116-
if (!$rootScope.$$phase) {
117-
return $rootScope.$apply(function () {
118-
return originals[functionsToWrap[i]].apply(store, args);
119-
});
120-
}
121-
return originals[functionsToWrap[i]].apply(store, args);
122-
};
114+
store[functionsToWrap[i]] = (function (name) {
115+
return function () {
116+
var args = arguments;
117+
if (!$rootScope.$$phase) {
118+
return $rootScope.$apply(function () {
119+
return originals[name].apply(store, args);
120+
});
121+
}
122+
return originals[name].apply(store, args);
123+
};
124+
})(functionsToWrap[i]);
123125
}
124126

125127
return store;

0 commit comments

Comments
 (0)