Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Don't burn down and rebuild DOM on re-sort #9

Open
jmarantz opened this issue Nov 26, 2016 · 3 comments
Open

Don't burn down and rebuild DOM on re-sort #9

jmarantz opened this issue Nov 26, 2016 · 3 comments

Comments

@jmarantz
Copy link
Owner

No description provided.

@jmarantz
Copy link
Owner Author

This is a bit annoying to do, because the event listeners for the nodes currently are registered with an anonymous function binding back to the player. Resetting that listener appears to be impossible in HTML/JS.

The best way to do this appears to be to set up the listener functions based on the index into the sorted players table.

@jmarantz
Copy link
Owner Author

Doing this nicely requires an MVC refactor, which is looking useful anyway. E.g. if the model were separate from the UI structures, it could be more easily serialized/deserialized using JSON support.-

It may also be easier to plug in a second storage back-end. Currently it just supports local-storage, which is probably a good default, but it ties the team to a single device.

@jmarantz
Copy link
Owner Author

I just thought of a simpler way to do it: bind a player-index into the listener events and use an array of player names. The array of strings can be re-arranged, but the indexes and listeners don't need to change.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant