Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Custom hook using IntersectionObserver #35835

Merged
merged 51 commits into from
Sep 10, 2021
Merged
Changes from 1 commit
Commits
Show all changes
51 commits
Select commit Hold shift + click to select a range
83d0e03
WIP
dmanek Aug 27, 2021
cb63234
check if win is undefined
dmanek Aug 27, 2021
9c69c62
WIP
dmanek Aug 27, 2021
7d10560
Apply suggestions from code review
dmanek Aug 27, 2021
616d233
address code review comments
dmanek Aug 27, 2021
13411f2
allow multiple callbacks for InOb
dmanek Aug 27, 2021
fdb2296
update time ago to use useIntersectionObserver hook
dmanek Aug 27, 2021
e7262b7
Merge branch 'main' into inob-hook
dmanek Aug 27, 2021
6419bc7
clean up, add tests
dmanek Aug 27, 2021
9732c00
use Map instead of object
dmanek Aug 29, 2021
35b8ec4
change useInOb method signature, remove console.log's
dmanek Aug 29, 2021
34ac7b7
change width from 100vw to 100% to prevent horizontal scrollbar
dmanek Aug 29, 2021
c7a4b1b
fix failing test
dmanek Aug 30, 2021
a814088
Merge branch 'main' into inob-hook
dmanek Aug 30, 2021
ff6de56
Merge branch 'main' into inob-hook
dmanek Aug 31, 2021
a201062
change `Map` to `WeakMap`
dmanek Aug 31, 2021
53b2bf5
Apply suggestions from code review
dmanek Aug 31, 2021
72d89de
address code review comments
dmanek Sep 1, 2021
8638a38
use `observeWithSharedInOb` & `unobserveWithSharedInOb` methods in hook
dmanek Sep 1, 2021
1c82685
pass `IntersectionObserverEntry` into callback function
dmanek Sep 1, 2021
be78295
lint
dmanek Sep 1, 2021
4400d93
WIP
dmanek Sep 1, 2021
70f05e1
Merge branch 'main' into inob-hook
dmanek Sep 1, 2021
feb2736
update `useIntersectionObserver` to return callback ref
dmanek Sep 1, 2021
0eb6859
Update src/preact/component/intersection-observer-resize.js
dmanek Sep 1, 2021
2852b62
address code review comments
dmanek Sep 1, 2021
a4f82a1
address code review comment
dmanek Sep 1, 2021
de94006
Apply suggestions from code review
dmanek Sep 2, 2021
e1b4b11
Merge branch 'main' into inob-hook
dmanek Sep 2, 2021
4ab8f1c
Merge branch 'inob-hook' of github.com:ampproject/amphtml into inob-hook
dmanek Sep 2, 2021
a7d5fc3
address code review comments
dmanek Sep 2, 2021
82f7a94
address code review comment
dmanek Sep 2, 2021
2859484
address code review comment
dmanek Sep 2, 2021
836cb01
wrapper method to maintain backwards compatibility
dmanek Sep 3, 2021
eed77ae
Merge branch 'main' into inob-hook
dmanek Sep 3, 2021
f47a164
address code review comment
dmanek Sep 3, 2021
6d848ae
fix type error & failing test
dmanek Sep 3, 2021
84f220e
fix type
dmanek Sep 3, 2021
b38e066
add unit test
dmanek Sep 7, 2021
6c9ca25
update unit test
dmanek Sep 7, 2021
65a7da6
Merge branch 'main' into inob-hook
dmanek Sep 8, 2021
251b824
fix failing check
dmanek Sep 9, 2021
05a7276
Merge branch 'main' into inob-hook
dmanek Sep 9, 2021
ef4df86
add unit test
dmanek Sep 9, 2021
ee65958
update resizing logic based on code review comments + update storyboo…
dmanek Sep 9, 2021
785fce4
remove duplicate test
dmanek Sep 9, 2021
44df73d
Update src/core/dom/layout/viewport-observer.js
dmanek Sep 9, 2021
7672b66
add TODO
dmanek Sep 9, 2021
50a2e23
add comment
dmanek Sep 9, 2021
c82eb8c
address code review comment
dmanek Sep 9, 2021
96a4e3f
rename `Timeago` to `BentoTimeago` in storybook
dmanek Sep 9, 2021
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions src/core/dom/layout/viewport-observer.js
Original file line number Diff line number Diff line change
Expand Up @@ -106,8 +106,7 @@ function ioCallback(entries) {
continue;
}
for (let k = 0; k < callbacks.length; k++) {
const callback = callbacks[k];
callback(entry);
callbacks[k].?();
dmanek marked this conversation as resolved.
Show resolved Hide resolved
}
}
}