Skip to content

Commit

Permalink
Use JSDoc tag to indicate deprecations (#95)
Browse files Browse the repository at this point in the history
  • Loading branch information
whymarrh authored Aug 17, 2020
1 parent d96c647 commit de5fbfc
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions src/MetamaskInpageProvider.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,10 +235,12 @@ module.exports = class MetamaskInpageProvider extends SafeEventEmitter {
setTimeout(() => this.emit('connect', { chainId: this.chainId }))

// TODO:deprecation:remove
/** @deprecated */
this._web3Ref = undefined

// TODO:deprecation:remove
// if true, MetaMask reloads the page if window.web3 has been accessed
/** @deprecated */
this.autoRefreshOnNetworkChange = true

// TODO:deprecation:remove
Expand Down Expand Up @@ -547,19 +549,19 @@ module.exports = class MetamaskInpageProvider extends SafeEventEmitter {

// TODO:deprecation:remove isEnabled, isApproved
/**
* DEPRECATED. To be removed.
* Synchronously determines if this domain is currently enabled, with a potential false negative if called to soon
*
* @deprecated
* @returns {boolean} - returns true if this domain is currently enabled
*/
isEnabled: () => {
return Array.isArray(this._state.accounts) && this._state.accounts.length > 0
},

/**
* DEPRECATED. To be removed.
* Asynchronously determines if this domain is currently enabled
*
* @deprecated
* @returns {Promise<boolean>} - Promise resolving to true if this domain is currently enabled
*/
isApproved: async () => {
Expand Down Expand Up @@ -589,9 +591,9 @@ module.exports = class MetamaskInpageProvider extends SafeEventEmitter {
//====================

/**
* DEPRECATED.
* Equivalent to: ethereum.request('eth_requestAccounts')
*
* @deprecated
* @returns {Promise<Array<string>>} - A promise that resolves to an array of addresses.
*/
enable () {
Expand All @@ -614,10 +616,10 @@ module.exports = class MetamaskInpageProvider extends SafeEventEmitter {
}

/**
* DEPRECATED.
* Sends an RPC request to MetaMask.
* Many different return types, which is why this method should not be used.
*
* @deprecated
* @param {(string | Object)} methodOrPayload - The method name, or the RPC request object.
* @param {Array<any> | Function} [callbackOrArgs] - If given a method name, the method's parameters.
* @returns {unknown} - The method result, or a JSON RPC response object.
Expand Down Expand Up @@ -653,8 +655,9 @@ module.exports = class MetamaskInpageProvider extends SafeEventEmitter {
}

/**
* DEPRECATED.
* Internal backwards compatibility method, used in send.
*
* @deprecated
*/
_sendSync (payload) {

Expand Down

0 comments on commit de5fbfc

Please sign in to comment.