Browse Source

fixes padded blocks; update PriorityQueue d.ts

Bruno Fanini 3 years ago
parent
commit
70ce7cdb23
2 changed files with 14 additions and 2 deletions
  1. 2 0
      src/utilities/PriorityQueue.d.ts
  2. 12 2
      src/utilities/PriorityQueue.js

+ 2 - 0
src/utilities/PriorityQueue.d.ts

@@ -3,6 +3,8 @@ export class PriorityQueue {
 	maxJobs : Number;
 	autoUpdate : Boolean;
 	priorityCallback : ( itemA : any , itemB : any ) => Number;
+	
+	schedulingCallback : ( func : Function ) => void;
 
 	sort() : void;
 	add( item : any, callback : ( item : any ) => any ) : Promise< any >;

+ 12 - 2
src/utilities/PriorityQueue.js

@@ -12,18 +12,25 @@ class PriorityQueue {
 		this.autoUpdate = true;
 
 		this.priorityCallback = () => {
+
 			throw new Error( 'PriorityQueue: PriorityCallback function not defined.' );
+
 		};
 
 		// Customizable scheduling callback. Default using requestAnimationFrame()
 		this.schedulingCallback = func => {
+
 			requestAnimationFrame( func );
+
 		};
 
-		this._runjobs = ()=>{
+		this._runjobs = () => {
+
 			this.tryRunJobs();
 			this.scheduled = false;
+
 		};
+
 	}
 
 	sort() {
@@ -114,10 +121,13 @@ class PriorityQueue {
 	}
 
 	scheduleJobRun() {
-		if ( !this.scheduled ){
+
+		if ( ! this.scheduled ){
+
 			this.schedulingCallback( this._runjobs );
 
 			this.scheduled = true;
+
 		}
 	}