Uh oh!
There was an error while loading. Please reload this page.
Changed PollingController to be a mixin so it can be used with both V1 and V2 controllers - #1736
Conversation
c162a8b to
82255b8CompareUh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
| } | ||
| setIntervalLength(length: number) { | ||
| this.#intervalLength = length; | ||
| } |
There was a problem hiding this comment.
does intervalLength need to be private if we're just exposing it?
There was a problem hiding this comment.
We could make it protected so that the extending class could decide to expose it or not. I doubt we need this to be configurable at runtime very often, if ever.
There was a problem hiding this comment.
I think there is a way to do this (make it protected), just not if I have an abstract class where the class has to be named.
| } catch (error) { | ||
| console.error(error); | ||
| onPollingComplete( |
There was a problem hiding this comment.
[nit]
| onPollingComplete( | |
| setOnPollingComplete( |
There was a problem hiding this comment.
Seems a bit more conventional as-is IMO. Event listeners are usually on____. Or add___Listener
| messenger, | ||
| metadata, | ||
| }); | ||
| #intervalLength = 1000; |
There was a problem hiding this comment.
[nit] Wondering if we ought remove a default and throw if never set?
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Gudahtt
left a comment
There was a problem hiding this comment.
Looks great! I can re-review after some of these suggestions are resolved
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Co-authored-by: Mark Stacey <markjstacey@gmail.com>
Integrates recently introduced [`PollingController` mixin](#1736) with `GasFeeController`. Leaves old polling pattern in pace for now so as to not force a ton of breaking changes for mobile, but with intention to activate new pattern in both clients ASAP. Addresses: MetaMask/MetaMask-planning#1314

Explanation
allows you to create a class which is a merge of many classes. I've added a V1 and a V2 version of the PollingController that can be used almost the same way as the original
PollingController.