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

Commit 18b57bf

Browse files
authored
Merge pull request #9 from JeffreyATW/master
Splice using index of subscriber ID, not ID itself
2 parents 7550ec7 + 059960b commit 18b57bf

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

src/native/utils/game-loop.js

+1-1
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((id - 1), 1);
25+
delete this.subscribers[id - 1];
2626
}
2727
}

src/utils/game-loop.js

+1-1
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((id - 1), 1);
25+
delete this.subscribers[id - 1];
2626
}
2727
}

0 commit comments

Comments
 (0)