Skip to content

Commit d98220c

Browse files
committed
YES finally banished all ts warnings
1 parent 404caec commit d98220c

3 files changed

Lines changed: 17 additions & 13 deletions

File tree

‎v5-unity/js/opt-frontend-common.ts‎

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -679,7 +679,7 @@ var TogetherjsCloseHandler = function() {
679679
alert("ERROR: need to override TogetherjsCloseHandler()");
680680
}
681681

682-
function startSharedSession() {
682+
var startSharedSession = function() {
683683
$("#ssDiv").hide(); // hide ASAP!
684684
$("#togetherjsStatus").html("Please wait ... loading shared session");
685685
TogetherJS();
@@ -823,6 +823,9 @@ function initializeFrontendParams(params) {
823823
if (params.TogetherjsCloseHandler) {
824824
TogetherjsCloseHandler = params.TogetherjsCloseHandler;
825825
}
826+
if (params.startSharedSession) {
827+
startSharedSession = params.startSharedSession;
828+
}
826829
if (params.initAceEditor) {
827830
initAceEditor = params.initAceEditor;
828831
}
@@ -835,7 +838,7 @@ var num414Tries = 0; // hacky global
835838
function genericOptFrontendReady(params) {
836839
assert(params);
837840
initializeFrontendParams(params);
838-
initTogetherJS(); // initialize early
841+
initTogetherJS(); // initialize early but after initializeFrontendParams
839842

840843

841844
// be friendly to the browser's forward and back buttons

‎v5-unity/js/opt-frontend.ts‎

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -45,26 +45,26 @@ require('../css/opt-frontend.css');
4545
var originFrontendJsFile = 'opt-frontend.js';
4646

4747

48-
function startSharedSession() { // override default
48+
function optFrontendStartSharedSession() { // override default
4949
$("#ssDiv,#surveyHeader").hide(); // hide ASAP!
5050
$("#adHeader").hide(); // hide ASAP!
5151
$("#togetherjsStatus").html("Please wait ... loading shared session");
5252
TogetherJS();
5353
}
5454

5555

56-
function TogetherjsReadyHandler() {
56+
function optFrontendTogetherjsReadyHandler() {
5757
$("#surveyHeader").hide();
5858
optCommon.populateTogetherJsShareUrl();
5959
}
6060

61-
function TogetherjsCloseHandler() {
61+
function optFrontendTogetherjsCloseHandler() {
6262
if (optCommon.getAppMode() == "display") {
6363
$("#surveyHeader").show();
6464
}
6565
}
6666

67-
function executeCode(forceStartingInstr, forceRawInputLst) {
67+
function optFrontendExecuteCode(forceStartingInstr, forceRawInputLst) {
6868
if (forceRawInputLst !== undefined) {
6969
optCommon.setRawInputLst(forceRawInputLst); // UGLY global across modules, FIXME
7070
}
@@ -684,9 +684,10 @@ $(document).ready(function() {
684684
});
685685

686686
optCommon.genericOptFrontendReady({originFrontendJsFile: originFrontendJsFile,
687-
executeCode: executeCode,
688-
TogetherjsReadyHandler: TogetherjsReadyHandler,
689-
TogetherjsCloseHandler: TogetherjsCloseHandler,
687+
executeCode: optFrontendExecuteCode,
688+
TogetherjsReadyHandler: optFrontendTogetherjsReadyHandler,
689+
TogetherjsCloseHandler: optFrontendTogetherjsCloseHandler,
690+
startSharedSession: optFrontendStartSharedSession,
690691
}); // initialize at the end
691692

692693

‎v5-unity/js/opt-live.ts‎

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ function optliveHandleUncaughtExceptionFunc(trace) {
368368
}
369369

370370
// override the one in opt-frontend-common.js
371-
function initAceEditor(height) {
371+
function optLiveInitAceEditor(height) {
372372
var pyInputAceEditor = ace.edit('codeInputPane');
373373
optCommon.setAceEditor(pyInputAceEditor); // don't forget this!
374374

@@ -577,7 +577,7 @@ function optliveLangToBackendScript(lang) {
577577

578578

579579
// overrides the version in opt-frontend.js
580-
function executeCode(forceStartingInstr, forceRawInputLst) {
580+
function optLiveExecuteCode(forceStartingInstr, forceRawInputLst) {
581581
$('#urlOutput').val(''); // clear to avoid stale values
582582

583583
var cod = optCommon.pyInputGetValue();
@@ -629,8 +629,8 @@ function optliveExecuteCodeFromScratch() {
629629

630630
$(document).ready(function() {
631631
optCommon.genericOptFrontendReady({originFrontendJsFile: originFrontendJsFile,
632-
executeCode: executeCode,
633-
initAceEditor: initAceEditor,
632+
executeCode: optLiveExecuteCode,
633+
initAceEditor: optLiveInitAceEditor,
634634
});
635635

636636
$('#legendDiv')

0 commit comments

Comments
 (0)