@@ -70,6 +70,66 @@ const CODE_SNAPSHOT_DEBOUNCE_MS = 1000;
7070const SUBMIT_UPDATE_HISTORY_INTERVAL_MS = 1000 * 60 ;
7171
7272
73+ class OptFrontend {
74+ sessionUUID : string = generateUUID ( ) ; // remains constant throughout one page load ("session")
75+
76+ myVisualizer ; // singleton ExecutionVisualizer instance from pytutor.ts
77+
78+ // 'edit' or 'display'. also support 'visualize' for backward
79+ // compatibility (same as 'display')
80+ appMode : string = 'edit' ;
81+
82+ // inputted by user for raw_input / mouse_input events
83+ rawInputLst : string [ ] = [ ] ;
84+
85+ isExecutingCode : boolean = false ;
86+
87+ originFrontendJsFile : string ;
88+ appStateAugmenter : any ; // super hacky! fixme
89+ loadTestCases : any ; // super hacky! fixme
90+
91+ executeCode : ( forceStartingInstr : number , forceRawInputLst : string [ ] ) => void ;
92+
93+ pyInputAceEditor ; // Ace editor object that contains the input code
94+
95+ dmp = new diff_match_patch ( ) ;
96+ curCode = '' ; // TODO: do we need this?
97+ deltaObj : { start : string , deltas : any [ ] , v : number , startTime : number , executeTime ?: number } = undefined ;
98+
99+ num414Tries = 0 ;
100+
101+ constructor ( originFrontendJsFile : string ,
102+ executeCode : ( forceStartingInstr : number , forceRawInputLst : string [ ] ) => void ,
103+ params = null ) {
104+ this . originFrontendJsFile = originFrontendJsFile ;
105+ this . executeCode = executeCode ;
106+
107+ // optional params -- TODO: handle later
108+ /*
109+ if (params.TogetherjsReadyHandler) {
110+ TogetherjsReadyHandler = params.TogetherjsReadyHandler;
111+ }
112+ if (params.TogetherjsCloseHandler) {
113+ TogetherjsCloseHandler = params.TogetherjsCloseHandler;
114+ }
115+ if (params.startSharedSession) {
116+ startSharedSession = params.startSharedSession;
117+ }
118+ if (params.initAceEditor) {
119+ initAceEditor = params.initAceEditor;
120+ }
121+ if (params.appStateAugmenter) {
122+ appStateAugmenter = params.appStateAugmenter;
123+ }
124+ if (params.loadTestCases) {
125+ loadTestCases = params.loadTestCases;
126+ }
127+ */
128+ }
129+
130+ } // END class OptFrontend
131+
132+
73133// TODO: encapsulate tons of globals into a class of some sort:
74134
75135var myVisualizer = null ; // singleton ExecutionVisualizer instance
@@ -176,7 +236,6 @@ function supports_html5_storage() {
176236 }
177237}
178238
179-
180239function initDeltaObj ( ) {
181240 // make sure the editor already exists
182241 // (editor doesn't exist when you're, say, doing an iframe embed)
0 commit comments