- this.fetchProblems(this.display, direction);
- const newSize = curProbs.length;
- if (curSize == newSize) //no problems found
- return this.noMoreProblems("No more problems in this direction");
- // Ok, found something:
- this.curProb = this.findClosestNeighbor(this.curProb, curProbs, direction);
+ this.fetchProblems(this.display, direction, problems => {
+ if (problems.length > 0)
+ {
+ // Ok, found something:
+ this.curProb =
+ this.findClosestNeighbor(this.curProb, curProbs, direction);
+ }
+ else
+ nomorePb();
+ });