Skip to content

Commit

Permalink
refactor: Remove deferred.reject since it's not used
Browse files Browse the repository at this point in the history
  • Loading branch information
kidroca committed Jul 26, 2021
1 parent 96faca1 commit 9549e40
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions lib/createDeferredTask.js
Original file line number Diff line number Diff line change
@@ -1,16 +1,15 @@
/**
* Create a deferred task that can be resolved when we call `resolve()`
* The returned promise will complete only when we call `resolve` or `reject`
* The returned promise will complete when we call `resolve`
* Useful when we want to wait for a tasks that is resolved from an external action
*
* @template T
* @returns {{ resolve: function(*), reject: function(Error), promise: Promise<T|void> }}
* @returns {{ resolve: function(*), promise: Promise<T|void> }}
*/
export default function createDeferredTask() {
const deferred = {};
deferred.promise = new Promise((res, rej) => {
deferred.promise = new Promise((res) => {
deferred.resolve = res;
deferred.reject = rej;
});

return deferred;
Expand Down

0 comments on commit 9549e40

Please sign in to comment.