22 *
33 * Created by bmiller on 3/19/15.
44 */
5+ /* Define global variables for ESLint */
6+ /* global Sk */
7+
58"use strict" ;
69
710import RunestoneBase from "../../common/js/runestonebase.js" ;
@@ -1132,40 +1135,39 @@ Yet another is that there is an internal error. The internal error message is:
11321135 return Promise . resolve ( prog ) ;
11331136 }
11341137
1135- async manage_scrubber ( scrubber_dfd , history_dfd , saveCode ) {
1138+ async manage_scrubber ( saveCode ) {
1139+ let scrubber_dfd = false ;
11361140 if ( this . historyScrubber === null && ! this . autorun ) {
11371141 scrubber_dfd = await this . addHistoryScrubber ( ) ;
11381142 }
1139- if (
1140- this . historyScrubber &&
1141- this . history [ $ ( this . historyScrubber ) . slider ( "value" ) ] !=
1142- this . editor . getValue ( )
1143- ) {
1144- saveCode = "True" ;
1145- this . history . push ( this . editor . getValue ( ) ) ;
1146- this . timestamps . push ( new Date ( ) . toLocaleString ( ) ) ;
1147- $ ( this . historyScrubber ) . slider (
1148- "option" ,
1149- "max" ,
1150- this . history . length - 1
1151- ) ;
1152- $ ( this . historyScrubber ) . slider (
1153- "option" ,
1154- "value" ,
1155- this . history . length - 1
1156- ) ;
1157- this . slideit ( ) ;
1158- } else {
1159- saveCode = "False" ;
1160- }
1161- if ( this . historyScrubber == null ) {
1162- saveCode = "False" ;
1143+ if ( scrubber_dfd && scrubber_dfd . ok ) {
1144+ if (
1145+ this . historyScrubber &&
1146+ this . history [ $ ( this . historyScrubber ) . slider ( "value" ) ] !=
1147+ this . editor . getValue ( )
1148+ ) {
1149+ saveCode = "True" ;
1150+ this . history . push ( this . editor . getValue ( ) ) ;
1151+ this . timestamps . push ( new Date ( ) . toLocaleString ( ) ) ;
1152+ $ ( this . historyScrubber ) . slider (
1153+ "option" ,
1154+ "max" ,
1155+ this . history . length - 1
1156+ ) ;
1157+ $ ( this . historyScrubber ) . slider (
1158+ "option" ,
1159+ "value" ,
1160+ this . history . length - 1
1161+ ) ;
1162+ this . slideit ( ) ;
1163+ } else {
1164+ saveCode = "False" ;
1165+ }
1166+ if ( this . historyScrubber == null ) {
1167+ saveCode = "False" ;
1168+ }
11631169 }
1164- history_dfd = Promise . resolve ( {
1165- history_dfd : scrubber_dfd ,
1166- saveCode : saveCode ,
1167- } ) ;
1168- return history_dfd ;
1170+ return Promise . resolve ( saveCode ) ;
11691171 }
11701172
11711173 async checkCurrentAnswer ( ) {
@@ -1238,7 +1240,6 @@ Yet another is that there is an internal error. The internal error message is:
12381240 this . isAnswered = true ;
12391241 var prog = await this . buildProg ( true ) ;
12401242 this . saveCode = "True" ;
1241- var scrubber_dfd , history_dfd ;
12421243 $ ( this . output ) . text ( "" ) ;
12431244 $ ( this . eContainer ) . remove ( ) ;
12441245 if ( this . codelens ) {
@@ -1277,14 +1278,7 @@ Yet another is that there is an internal error. The internal error message is:
12771278 duration : 700 ,
12781279 queue : false ,
12791280 } ) ;
1280- var __ret = await this . manage_scrubber (
1281- scrubber_dfd ,
1282- history_dfd ,
1283- this . saveCode
1284- ) ;
1285- history_dfd = __ret . history_dfd ;
1286- this . saveCode = __ret . saveCode ;
1287- promise_list . push ( __ret ) ;
1281+ this . saveCode = await this . manage_scrubber ( this . saveCode ) ;
12881282 }
12891283 this . run_promise = Sk . misceval . asyncToPromise ( function ( ) {
12901284 return Sk . importMainWithBody ( "<stdin>" , false , prog , true ) ;
@@ -1295,7 +1289,7 @@ Yet another is that there is an internal error. The internal error message is:
12951289 var self = this ;
12961290 Promise . all ( promise_list )
12971291 . then (
1298- function ( mod ) {
1292+ function ( ) {
12991293 $ ( this . runButton ) . removeAttr ( "disabled" ) ;
13001294 if ( ! noUI ) {
13011295 if ( this . slideit ) {
0 commit comments