我使用jQuery.Deferred并承诺在我的JS类中监听更新。 当我不再需要时,如何删除进度处理程序。
//some place in the code:
var $deferred = $.Deferred()
$promise = $deferred.promise();
/// them sometimes:
$promise.notify('use requests action');
// somewhere else:
$promise.progress(progessHandler);
function progessHandler(msg){
console.log(msg);
}
// then later
// how do I unsubscribe from the progress update?
$promise.?????(progessHandler);
非常感谢任何帮助。