Search Posts

Category: bluebird

Controlling flow with nested promises in loop

I’m having trouble controlling the flow of my method using promises: //FIND CHECKED OUT FILES getCheckedOutFiles = function () { console.log(‘Get checked out files’); var d = $q.defer(); // Store final results and pass to then callback var checkedOutFiles = window.x = []; // Promise, returns collection with all sites SiteService.getAllSites() .then(sites => { // For each site get lists then get items matching filter sites.forEach(function (site) { var web = new $pnp.Web(site.url); return web.lists […]