Skip to content

Commit

Permalink
lib: cockpit: remove cockpit.when()
Browse files Browse the repository at this point in the history
Replace the only user of this API with the native Promise equivalent.

This API was never publically documented so nothing should depend on it.
  • Loading branch information
jelly authored and martinpitt committed Nov 15, 2024
1 parent 1aba6ed commit 9e11be6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 7 deletions.
6 changes: 0 additions & 6 deletions pkg/lib/cockpit.js
Original file line number Diff line number Diff line change
Expand Up @@ -116,12 +116,6 @@ function factory() {
},
};

cockpit.when = function when(value, fulfilled, rejected, updated) {
const result = cockpit.defer();
result.resolve(value);
return result.promise.then(fulfilled, rejected, updated);
};

cockpit.defer = function() {
return new Deferred();
};
Expand Down
2 changes: 1 addition & 1 deletion pkg/shell/machines/machines.js
Original file line number Diff line number Diff line change
Expand Up @@ -205,7 +205,7 @@ function Machines() {
const data = { ...machine, ...values };
window.sessionStorage.setItem(skey, JSON.stringify(data));
self.overlay(host, values);
return cockpit.when([]);
return Promise.resolve([]);
}

function update_saved_machine(host, values) {
Expand Down

0 comments on commit 9e11be6

Please sign in to comment.