Skip to content

Commit

Permalink
Merge pull request #6055 from xianyinchen/v2.2.0-fixed-issues
Browse files Browse the repository at this point in the history
avoid cc.game.once multiple triggers.
  • Loading branch information
holycanvas committed Jan 10, 2020
2 parents 89ce203 + 9ac70c9 commit 94c6ee5
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions cocos2d/core/CCGame.js
Expand Up @@ -432,14 +432,14 @@ var game = {
* @typescript
* on<T extends Function>(type: string, callback: T, target?: any, useCapture?: boolean): T
*/
on (type, callback, target) {
on (type, callback, target, once) {
// Make sure EVENT_ENGINE_INITED and EVENT_GAME_INITED callbacks to be invoked
if ((this._prepared && type === this.EVENT_ENGINE_INITED) ||
(!this._paused && type === this.EVENT_GAME_INITED)) {
callback.call(target);
}
else {
this.eventTargetOn(type, callback, target);
this.eventTargetOn(type, callback, target, once);
}
},
/**
Expand Down

0 comments on commit 94c6ee5

Please sign in to comment.