Skip to content

Commit

Permalink
parametrize delay (#32)
Browse files Browse the repository at this point in the history
  • Loading branch information
MV88 authored May 11, 2021
1 parent ba3f3df commit db5fc06
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion web/client/epics/__tests__/geostory-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -1638,7 +1638,7 @@ describe('Geostory Epics', () => {

it('urlUpdateOnScroll', (done) => {
const NUM_ACTIONS = 1;
testEpic(addTimeoutEpic(urlUpdateOnScroll, 1000), NUM_ACTIONS, [updateCurrentPage({sectionId: "sectionId"})],
testEpic(addTimeoutEpic(urlUpdateOnScroll, 100), NUM_ACTIONS, [updateCurrentPage({sectionId: "sectionId"})],
(actions) => {
expect(actions[0].type).toBe(TEST_TIMEOUT);
done();
Expand Down
6 changes: 3 additions & 3 deletions web/client/epics/geostory.js
Original file line number Diff line number Diff line change
Expand Up @@ -544,10 +544,10 @@ export const urlUpdateOnScroll = (action$, {getState}) =>
*/
export const scrollOnLoad = (action$) =>
action$.ofType(SET_CURRENT_STORY)
.switchMap(() => {
.switchMap(({delay = 500}) => {
const storyIds = window?.location?.hash?.split('/');
return Observable.of(storyIds)
.delay(500)
.delay(delay)
.do(() => {
if (window?.location?.hash?.includes('shared')) {
scrollToContent(storyIds[7] || storyIds[5], {block: "start", behavior: "auto"});
Expand All @@ -560,7 +560,7 @@ export const scrollOnLoad = (action$) =>
)
.ignoreElements()
.startWith(geostoryScrolling(true))
.concat(Observable.of(geostoryScrolling(false)).delay(500));
.concat(Observable.of(geostoryScrolling(false)).delay(delay));
});

/**
Expand Down

0 comments on commit db5fc06

Please sign in to comment.