Skip to content

Conversation

tristanmkernan
Copy link
Collaborator

closes #1324

the problem was that arrow functions in javascript absorb the this of the parent scope, while jquery likes to bind this of event handlers to the given element. so changing the arrow function to a normal function did the trick

@DreadKnight
Copy link
Member

Good job! @russon77 👍

@@ -621,6 +621,7 @@ export class UI {
*/
showCreature(creatureType, player) {
let game = this.game;
let that = this;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If we must use this horrible practice. Please use self not that

if (game.freezedInput) {
return;
}

this.showCreature('--', $j(this).attr('player') - 0);
that.showCreature('--', $j(this).attr('player') - 0);
Copy link
Collaborator

@ktiedt ktiedt Jun 20, 2018

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would e.target for the $j() call not also resolve this without the that reference?

@tristanmkernan tristanmkernan restored the issue/1324 branch June 20, 2018 21:59
DreadKnight added a commit that referenced this pull request Jun 20, 2018
CyberBishop pushed a commit to CyberBishop/AncientBeast that referenced this pull request Apr 20, 2023
CyberBishop pushed a commit to CyberBishop/AncientBeast that referenced this pull request Apr 20, 2023
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

Successfully merging this pull request may close these issues.

dash player tabs broken
3 participants