1
0
mirror of https://github.com/kremalicious/metamask-extension.git synced 2024-12-23 09:52:26 +01:00

Document callback-style background calls as deprecated (#17376)

We've been migrating from callback-based to async background calls for
a number of years now. The async calls are easier to read, and less
likely to be misused (especially when it comes to error handling).

The `callBackgroundMethod` method, used to make a callback-based
background call, has been marked as deprecated. Hopefully this will
discourage further use.
This commit is contained in:
Mark Stacey 2023-01-26 12:27:15 -03:30 committed by GitHub
parent 5a493fb38e
commit 506ee16648
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -99,12 +99,13 @@ export function submitRequestToBackground(
}
/**
* Callback-style call to background method
* [Deprecated] Callback-style call to background method
* In MV2: invokes promisifiedBackground method directly.
* In MV3: action is added to retry queue, along with resolve handler to be executed on completion,
* the queue is then immediately processed if background connection is available.
* On completion (successful or error) the action is removed from the retry queue.
*
* @deprecated Use async `submitRequestToBackground` function instead.
* @param {string} method - name of the background method
* @param {Array} [args] - arguments to that method, if any
* @param callback - Node style (error, result) callback for finishing the operation