CodingGarden / entropychat.app

A discord clone made by the Coding Garden Community.
https://entropychat.app
103 stars 37 forks source link

postMessage and addEventListener once #18

Open ahmader opened 4 years ago

ahmader commented 4 years ago

https://github.com/CodingGarden/entropychat.app/blob/c76399c4bd5194ff58431c0e01f36b2e9203ba06/client/src/store/modules/auth.js#L43-L45

Because I am running Vue dev-tools, and it is sending messages for hot reload, I was confused. Sometimes I receive the token and most of the time I was not.

After debugging I've found adding once was not a good idea, instead I removeEventListener after receiving the token.

w3cj commented 4 years ago

That makes sense. Feel free to make a pull request with the changes.