Use Case:


There may be circumstances where you would like to use multiFetch but require more control over its execution, rather than simply implementing multiFetch in its default linear fashion (which does not allow registering and fetching while a fetch is in progress).


For example, if an end user clicks on a particular part of a page (e.g. Men's Fashion), but then quickly changes their mind and clicks on a different area (e.g., Women's Fashion) that executes a request for different types of recommendations, the default multiFetch mechanism would generate an error about the original operation still being in progress. With this new `abortActiveRequests` feature, the original `register` and `fetch` functions associated with the initial click would get aborted so that the new `register` and `fetch` operations associated with the second click may be accepted and executed without erroring out.


How to Use `abortActiveRequests`:


Add the special parameter `abortActiveRequests` in $p("register") and $p("fetch") to abort/cancel requests in progress if any exist. The cancelled `register` or `fetch` function(s) will no longer work (including any rendering functions in the callbacks that might rely on those aborted functions), but new `register` and `fetch` functions will be accepted.


Example code:

$p("register",{
    max: 5,
    widget: "new_news",
    opts: {maxAgeInSeconds: 60*60*24},
    callback: function(resp){
        console.log(resp)
    },
    abortActiveRequests: true
})


$p('fetch', {
    abortActiveRequests: true
})