project-slippi / slippi-js

Parse slp files and compute stats
GNU Lesser General Public License v3.0
148 stars 79 forks source link

Dynamically import enet #43

Closed vinceau closed 3 years ago

vinceau commented 3 years ago

The enet package was being imported and executed regardless of whether DolphinConnection was being used or not. This broke compatibility with the browser, and also causes strange messages to be logged whenever errors were thrown.

e.g. image

This PR makes it so that we only dynamically import the enet package when we actually attempt to connect to Dolphin. The connect interface has been changed to return a promise.