Conventions


Excel.run ( function (context) { 
    range.load('values');

    return context.sync(range)
    .then(function (range) {
    range.load('values');
    })
    .then(context.sync(range)
    .then(function (range) {
        range.load('values');
    })
    .then(context.sync(range)
    .then(function (range) {
    })
    .then(context.sync()
}).then(function () {
    console.log("Finished");
}).catch(function (error) {
    console.log(error);
});


Equivalent

Instead of returning the last promise using:

.then( function (result2) { 
   return context.sync();
})

you could use

.then( function (result2) { 
})
.then( context.sync )

If this last line is excluded, it will be added automatically.



TypeScript

When you declare using 'async' this will force the function to always return a Promise, even if it is the equivalent of 'return Promise.resolve()'.





© 2019 Better Solutions Limited. All Rights Reserved. © 2019 Better Solutions Limited TopPrev