Skip to content

Commit

Permalink
golf: inline isIntersecting filter;
Browse files Browse the repository at this point in the history
- 875 gz / 720 br
  • Loading branch information
lukeed committed Dec 10, 2018
1 parent 2cd1daf commit 1037e38
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/index.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -19,13 +19,13 @@ import requestIdleCallback from './request-idle-callback.mjs';

const loaderFunctions = new Map();
const observer = new IntersectionObserver(entries => {
entries
.filter(entry => entry.isIntersecting)
.forEach(entry => {
const url = entry.target.href;
const fn = loaderFunctions.get(url);
if (fn) fn.call(null);
});
entries.forEach(entry => {
if (entry.isIntersecting) {
const url = entry.target.href;
const fn = loaderFunctions.get(url);
if (fn) fn.call(null);
}
});
});

/**
Expand Down

0 comments on commit 1037e38

Please sign in to comment.