From bdd05b451b1650a6cd9c7dbfc6257a71a225f077 Mon Sep 17 00:00:00 2001 From: Martin Pitt Date: Mon, 25 Nov 2024 13:15:12 +0100 Subject: [PATCH] cockpit.js: Put back cockpit.{resolve,reject} Commit 132300e09cc45cbd was premature, subscription-manager still uses that [1]. Put it back, but in terms of the standard Promise API. Add a deprecation warning. [1] https://github.com/candlepin/subscription-manager-cockpit/pull/84 --- pkg/lib/cockpit.js | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/pkg/lib/cockpit.js b/pkg/lib/cockpit.js index 8d2d9e04ad8f..5811ce3a0f71 100644 --- a/pkg/lib/cockpit.js +++ b/pkg/lib/cockpit.js @@ -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(); };