Skip to content

Commit

Permalink
only 1 sleep
Browse files Browse the repository at this point in the history
  • Loading branch information
librasteve committed Sep 1, 2024
1 parent 9b773b9 commit 81281d3
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/Routes/Examples/Infinite-Scroll.rakumod
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ sub infinite_scroll-routes() is export {
}

sub gen-contacts($page=0, $size=20) {
sleep(0.4); #<= delay to make spinner visible
my @result = [.&gen-contact($page, $size) for ^$size];
@result[*-1]<last> = True;
@result;
Expand All @@ -20,11 +19,11 @@ sub infinite_scroll-routes() is export {
template-location 'templates/infinite_scroll';

get -> {
template 'index.crotmp', {contacts=>gen-contacts, next=>2};
template 'index.crotmp', {contacts=>gen-contacts, next=>1};
}

get -> 'contacts', :$page! {
sleep 1;
get -> 'contacts', Int :$page! {
sleep 1; #<= delay to make spinner visible
template 'partial.crotmp', {contacts=>gen-contacts($page), next=>($page+1)};
}
}
Expand Down

0 comments on commit 81281d3

Please sign in to comment.