Skip to content

Commit

Permalink
cockpit.js: Put back cockpit.{resolve,reject}
Browse files Browse the repository at this point in the history
Commit 132300e was premature, subscription-manager still uses
that [1]. Put it back, but in terms of the standard Promise API.

Add a deprecation warning.

[1] candlepin/subscription-manager-cockpit#84
  • Loading branch information
martinpitt committed Nov 25, 2024
1 parent d1f886b commit bdd05b4
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions pkg/lib/cockpit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,16 @@ function factory() {
},
};

cockpit.resolve = function resolve(result) {
console.warn("cockpit.resolve() is deprecated. Use Promise.resolve()");
return Promise.resolve(result);
};

cockpit.reject = function reject(ex) {
console.warn("cockpit.reject() is deprecated. Use Promise.reject()");
return Promise.reject(ex);
};

cockpit.defer = function() {
return new Deferred();
};
Expand Down

0 comments on commit bdd05b4

Please sign in to comment.