Skip to content

Commit e01ea78

Browse files
committed
f
1 parent 3cd82a7 commit e01ea78

File tree

3 files changed

+67
-67
lines changed

3 files changed

+67
-67
lines changed

dist/js-data-angular.js

Lines changed: 30 additions & 30 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/js-data-angular.js.map

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: 36 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -36,41 +36,6 @@ let functionsToWrap = [
3636
'inject'
3737
]
3838

39-
let unregisterDigestHook = null
40-
41-
42-
function registerDigestHook($rootScope) {
43-
return $rootScope.$watch(() => store.observe.Platform.performMicrotaskCheckpoint())
44-
}
45-
46-
47-
(window => {
48-
let timeout = null;
49-
50-
window.document.addEventListener('scroll', function(event){
51-
clearTimeout(timeout);
52-
53-
if (event.target.className.indexOf('ui-grid') > -1) {
54-
55-
// Unregister the watcher when scrolling inside of ui-grid
56-
unregisterDigestHook();
57-
58-
// Reattach the watcher when scrolling has completed. This timeout will be
59-
// replaced with a new one if another scroll event fires within 500ms.
60-
timeout = setTimeout(function(){
61-
unregisterDigestHook = registerDigestHook();
62-
}, 500);
63-
64-
} else {
65-
return;
66-
}
67-
68-
});
69-
70-
})(window)
71-
72-
73-
7439
function registerAdapter (adapter) {
7540
let Adapter
7641

@@ -267,9 +232,44 @@ angular.module('js-data', ['ng'])
267232
.provider('DS', DSProvider)
268233
.provider('DSHttpAdapter', DSHttpAdapterProvider)
269234
.run(['DS', 'DSHttpAdapter', (DS, DSHttpAdapter, $rootScope) => {
235+
236+
let unregisterDigestHook = null
270237
registerDigestHook($rootScope)
271238
DS.registerAdapter('http', DSHttpAdapter, { 'default': true })
272-
}])
239+
240+
241+
function registerDigestHook() {
242+
return $rootScope.$watch(() => store.observe.Platform.performMicrotaskCheckpoint())
243+
}
244+
245+
(window => {
246+
let timeout = null;
247+
248+
window.document.addEventListener('scroll', function(event){
249+
clearTimeout(timeout);
250+
251+
if (event.target.className.indexOf('ui-grid') > -1) {
252+
253+
// Unregister the watcher when scrolling inside of ui-grid
254+
unregisterDigestHook($rootScope);
255+
256+
// Reattach the watcher when scrolling has completed. This timeout will be
257+
// replaced with a new one if another scroll event fires within 500ms.
258+
timeout = setTimeout(function(){
259+
unregisterDigestHook = registerDigestHook();
260+
}, 500);
261+
262+
} else {
263+
return;
264+
}
265+
266+
});
267+
268+
})(window)
269+
270+
271+
272+
}]);
273273

274274
for (var i = 0; i < adapters.length; i++) {
275275
registerAdapter(adapters[i])

0 commit comments

Comments
 (0)