let resp = await new Promise(function(resolve, reject) { // simulating time consuming process setTimeout(() => resolve('Promise RESOLVED !'), 3000); // hit a button to cancel the promise $('#btn').click(() => resolve('Promise CANCELED !')); });