Lets say I have a given function I can not change which has a callback function:
markAsRead(item_id,function(result){console.log(result)})
How can I wrap that function with a promise so I could know which item_id was returned? Something like this:
markRead(item_id).then(function(result)
{
emailOwner(result)
},
function(result)
{
emailSystem(result)
});