Skip to content

Commit

Permalink
Merge pull request #62 from soltycabbage/fix-performance-bug
Browse files Browse the repository at this point in the history
15s 毎に bind() していくのでやばいらしいよ
  • Loading branch information
karihei committed Jan 27, 2014
2 parents 5c4bf37 + d516dc2 commit 7218ae3
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions app/beamQuest/ctrl/fieldMap.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,17 @@ var FieldMap = function(map) {
this.scheduleUpdate();

this.map = map;

this.initMobs_();
setInterval(this.initMobs_.bind(this), FieldMap.POP_INTERVAL);
};
util.inherits(FieldMap, EntityCtrl);

FieldMap.POP_INTERVAL = 15000;

/** @override */
FieldMap.prototype.update = function() {
this.initMobs_();
setInterval(this.initMobs_.bind(this), FieldMap.POP_INTERVAL);
// ここに毎ループの処理を書いてくよ
};

/**
Expand Down Expand Up @@ -70,4 +72,4 @@ FieldMap.prototype.randomPosition_ = function() {
return position;
};

module.exports = FieldMap;
module.exports = FieldMap;

0 comments on commit 7218ae3

Please sign in to comment.