Currently I've started developing some Apps for Office 2013. To develop these apps I'm using office.js which is designed to work with Excel worksheets for example.
Most of the APIs are like:
document.getSelectedDataAsync(p1, p2, function(asyncResult)
{
if (asyncResult.status == 'success')
// do something with asyncResult.value
else if (asyncResult.status == 'fail')
// show asyncResult.error as Error
});
I don't like this type of asynchronous programming. Rather I prefer to use promises and write something like:
document.getSelectedDataAsync(p1, p2)
.done(function(result)
{
// do something with result
})
.fail(function(error)
{
// show error message
})
Is there any way to use office.js API using promises like above?