Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
just a tiny change to improve memory usage. A weakmap entry get automatically removed when key get garbage collected. which would in this case only happen when you remove a switch. and therefor also no longer need the meta data you store in the map. I would also suggest to create a custom element that extends the input element, this way you do not have to manually init each switch, and all switches added in runtime are also automatically initialized for you. with the current code if I were to add a new switch to the DOM it would not work with the drag. I do realise this is out of the scope of this challenge. but I estimate it is about the same amount of code, and sets a good example for beginners imo (custom elements / webcomponents are the future imo)
- Loading branch information