Skip to content

Commit

Permalink
refactor: Simplify Engine constructor
Browse files Browse the repository at this point in the history
The Engine class is riddled with type errors, which has been making the
controller updates difficult. In attempting to address these errors,
one of the first obstacles was the conditional constructor. The types
for the class would be a lot simpler if we could assume that certain
properties were always initialized, but the condition prevents that.

The condition was meant to ensure that only one global Engine instance
was ever constructed. This check has been moved to the `init` function
at the end of the file instead. This has the same effect, as that
function is the only place the Engine class is constructed (it's not
exported). This is much easier for TypeScript to understand.

This relates to MetaMask/mobile-planning#1015
  • Loading branch information
Gudahtt committed Aug 31, 2023
1 parent 9ccfbc3 commit bfa2b63
Showing 1 changed file with 388 additions and 395 deletions.
Loading

0 comments on commit bfa2b63

Please sign in to comment.