jason.lu 6 years ago
parent
commit
761d3afa7d
1 changed files with 6 additions and 0 deletions
  1. 6 0
      js/newCommon.js

+ 6 - 0
js/newCommon.js

@@ -33,6 +33,7 @@ const DataObjectList = function (name) {
   this.isSorted = false;
   this.preSort = [];
   this.comparisonBasis = null;
+  this.isSorting = false;
   /** *
      * sorting
      * @param comparator (a,b)  =====>  a - b
@@ -44,7 +45,12 @@ const DataObjectList = function (name) {
     for (let i = 0; i < this.list.length; i++) {
       this.preSort.push(this.list[i]);
     }
+    if(this.isSorting){
+      return;
+    }
+    this.isSorting = true;
     this.quickSort(this.preSort, 0, this.preSort.length - 1, this.comparisonBasis, this);
+    this.isSorting = false;
   };
 
   this.clearData = function () {