Search Posts

Category: bluebird

Setting a timeout for each promise within a promise.all

I am able to successfully perform a Promise.all, and gracefully handle resolves and rejects. However, some promises complete within a few milliseconds, some can/could take a while. I want to be able to set a timeout for each promise within the Promise.all, so it can attempt to take a maximum of say 5seconds. getData() { var that = this; var tableUrls = [‘http://table-one.com’,’http://table-two.com’]; var spoonUrls = [‘http://spoon-one.com’,’http://spoon-two.com’]; var tablePromises = that.createPromise(tableUrls); var spoonPromises = that.createPromise(spoonUrls); […]

Unable to find elements from the table using protractor

Unable to locate the element in the table using protractor and bluebird promise concepts HTML page – using angular JS TFL712363160734TFLNo Plea Code used to search and return the prose value : this.searchIndex = function (myurn) { return(()=> { var my_table = element(by.css(“case-list-table tbody tr”)); var td = my_table.element(by.css(“td:first-child”)); element.all(td.each(function (element, index) { element.getText().then(function (text) { console.log(“outer” + text); console.log(index, text); if (text.matches(myurn)) { console.log(“Inner” + text); return promise.props({ index:index}); } }); }); }); }; […]

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 […]