forked from MattStultz/extrusiongen
-
Notifications
You must be signed in to change notification settings - Fork 1
/
IKRS.ProcessListener.js
76 lines (59 loc) · 1.94 KB
/
IKRS.ProcessListener.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
/**
* @author Ikaros Kappler
* @date 2013-10-06
* @version 1.0.0
**/
IKRS.ProcessListener = function( startCallback,
stepCallback,
terminationCallback,
stepIntervalLength
) {
IKRS.Object.call( this );
if( typeof stepInterValLength == "undefined" )
stepInterValLength = 75;
this.totalStepCount = 0;
this.currentStep = 0;
this.stepIntervalLength = stepIntervalLength;
this.startCallback = startCallback;
this.stepCallback = stepCallback;
this.terminationCallback = terminationCallback;
};
IKRS.ProcessListener.prototype = new IKRS.Object();
IKRS.ProcessListener.prototype.constructor = IKRS.ProcessListener;
IKRS.ProcessListener.prototype.getCurrentStep = function() {
return this.currentStep;
}
/**
* Get the total step count (the number of processing steps which
* are required to terminate the whole process).
**/
IKRS.ProcessListener.prototype.getTotalStepCount = function() {
return this.totalStepCount;
}
/**
* Set the total step count (the number of processing steps which
* are required to terminate the whole process).
**/
IKRS.ProcessListener.prototype.setTotalStepCount = function( steps ) {
this.totalStepCount = steps;
}
IKRS.ProcessListener.prototype.getStepIntervalLength = function() {
return this.stepIntervalLength;
}
IKRS.ProcessListener.prototype.reportStart = function( totalStepCount ) {
this.currentStp = 0;
this.setTotalStepCount( totalStepCount );
this.startCallback( 0, totalStepCount );
}
IKRS.ProcessListener.prototype.reportCurrentStep = function( currentStep ) {
//window.alert( "Current step: " + currentStep );
this.currentStep = currentStep;
this.stepCallback( this.getCurrentStep(),
this.getTotalStepCount()
);
}
IKRS.ProcessListener.prototype.reportTemination = function() {
this.terminationCallback( this.getTotalStepCount(),
this.getTotalStepCount()
);
}