Skip to content
This repository was archived by the owner on Feb 7, 2024. It is now read-only.

Commit 059960b

Browse files
committed
Delete instead of splice
1 parent a9e4fd9 commit 059960b

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/native/utils/game-loop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export default class GameLoop {
2222
return this.subscribers.push(callback);
2323
}
2424
unsubscribe(id) {
25-
this.subscribers.splice(this.subscribers.indexOf(id), 1);
25+
delete this.subscribers[id - 1];
2626
}
2727
}

src/utils/game-loop.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,6 @@ export default class GameLoop {
2222
return this.subscribers.push(callback);
2323
}
2424
unsubscribe(id) {
25-
this.subscribers.splice(this.subscribers.indexOf(id), 1);
25+
delete this.subscribers[id - 1];
2626
}
2727
}

0 commit comments

Comments
 (0)