@@ -23,7 +23,7 @@ class Engine {
23
23
this . _actualFrameRate = 0 ;
24
24
this . _noLoop = false ;
25
25
this . _then = null ;
26
- this . _recording = false ;
26
+ this . _is_recording = false ;
27
27
this . _first_frame_recorded = 0 ;
28
28
this . _zip = null ;
29
29
@@ -78,7 +78,7 @@ class Engine {
78
78
this . draw ( ) ;
79
79
this . _ctx . restore ( ) ;
80
80
// save current frame if recording
81
- if ( this . _recording ) {
81
+ if ( this . _is_recording ) {
82
82
// compute frame name
83
83
const frame_count = this . _frameCount - this . _first_frame_recorded ;
84
84
const filename = frame_count . toString ( ) . padStart ( 7 , 0 ) + ".png" ;
@@ -114,7 +114,7 @@ class Engine {
114
114
* Start recording frames
115
115
*/
116
116
startRecording ( ) {
117
- this . _recording = true ;
117
+ this . _is_recording = true ;
118
118
this . _first_frame_recorded = this . _frameCount ;
119
119
this . _zip = new JSZip ( ) ;
120
120
}
@@ -123,7 +123,7 @@ class Engine {
123
123
* Stop recording frames
124
124
*/
125
125
stopRecording ( ) {
126
- this . _recording = false ;
126
+ this . _is_recording = false ;
127
127
}
128
128
129
129
/**
@@ -134,7 +134,7 @@ class Engine {
134
134
saveRecording ( filename = "frames.zip" ) {
135
135
// if the recording is not active, do nothing
136
136
// also skipped if no frame has been recorded
137
- if ( this . _recording || ! this . _zip ) return ;
137
+ if ( this . _is_recording || ! this . _zip ) return ;
138
138
139
139
// download zip file
140
140
this . _zip . generateAsync ( { type : "blob" } ) . then ( ( blob ) => {
@@ -366,7 +366,7 @@ class Engine {
366
366
* @returns {Boolean } The current recording state
367
367
*/
368
368
get recording ( ) {
369
- return this . _recording ;
369
+ return this . _is_recording ;
370
370
}
371
371
372
372
/**
@@ -414,6 +414,13 @@ class Engine {
414
414
get height ( ) {
415
415
return this . _canvas . height ;
416
416
}
417
+
418
+ /**
419
+ * Get the current recording state
420
+ */
421
+ get is_recording ( ) {
422
+ return this . _is_recording ;
423
+ }
417
424
}
418
425
419
426
document . addEventListener ( "DOMContentLoaded" , ( ) => {
0 commit comments