Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
async: Write BackoffMachine's methods properly.
As Greg points out [1], about the current (subtly incorrect) form: """ I believe the semantics of this is actually that that [`methodName = …`] becomes part of the constructor! Not a method on the class. """ We want methods on the class, so, write them that way (as "method definitions") [2]. In particular, in an upcoming commit where we test a new `tryFetch` implementation that retries a network request until a timeout, we'll want to mock `BackoffMachine.prototype.wait` so we don't have to think about it within those tests. (BackoffMachine has its own unit tests, after all.) Making `wait` an actual method on the class lets us accomplish this straightforwardly. [1] https://chat.zulip.org/#narrow/stream/243-mobile-team/topic/user_avatar_url_field_optional/near/909006 [2] https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Method_definitions
- Loading branch information