How to ensure that multiple promise execution of a third party is completed

the third-party js, I called has several methods to execute promise, as follows:

function  init(){
    a();
    b();
    c();
    //
    ....
    ...
}

function a(){
    var q = [x,y]; //promise
    Promise.all(q).then(function(arr){
         .....
    });
}

function b(){
    var q = [m,n]; //promise
    Promise.all(q).then(function(arr){
         .....
    });
}

function c(){
    var q = [j,k]; //promise
    Promise.all(q).then(function(arr){
         .....
    });
}

my calling function:

function call(){
    init();
    //initpromise, 
    ......
}

my confusion is that I cannot modify the above third-party code in the, call () function to ensure that all the promise in the init has been executed. I would appreciate your advice.

Nov.29,2021

cannot, unless he a/b/c function return Promise.all , you can't do anything in init .

Menu