[Vuejs]-Infinite scrolling from two different API endpoints

0👍

Your question is somewhat unclear, but it sounds like you want to have one of two actions fire. The easiest way to accomplish this, would be to write a scroll handler that can decide which action to fire, and then run it accordingly. In the following example I am running them in sequence, but you could decide based on other state if necessary.

For example:

 var handlers = [
    getItems('api/latest.json', 10, 1, 450),
    doSearch // handler involving your other endpoint
 ]
 var nextHandler = 0;

 function scrollHandler(e){
   handlers[nextHandler++](e);
   nextHandler = nextHandler % handlers.length; // wrap around if necessary
 }

 window.addEventListener('scroll', scrollHandler)
👤Mobius

Leave a comment