Skip to content

Commit 3f1868f

Browse files
committed
added ts labels
1 parent dc8b69c commit 3f1868f

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎v3/js/pytutor.js‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ var curVisualizerID = 1; // global to uniquely identify each ExecutionVisualizer
113113
// tabularView - render a tabular view of ALL steps at once (EXPERIMENTAL)
114114
// lang - to render labels in a style appropriate for other languages,
115115
// and to display the proper language in langDisplayDiv
116-
// e.g., 'py2' for Python 2, 'py3' for Python 3, 'js' for JavaScript, 'java' for Java
116+
// e.g., 'py2' for Python 2, 'py3' for Python 3, 'js' for JavaScript, 'java' for Java, 'ts' for TypeScript
117117
// [default is Python-style labels]
118118
// debugMode - some extra debugging printouts
119119
function ExecutionVisualizer(domRootID, dat, params) {
@@ -516,6 +516,8 @@ ExecutionVisualizer.prototype.render = function() {
516516
var pyVer = '2'; // default
517517
if (this.params.lang === 'js') {
518518
pyVer = 'js';
519+
} else if (this.params.lang === 'ts') {
520+
pyVer = 'ts';
519521
} else if (this.params.lang === 'java') {
520522
pyVer = 'java';
521523
} else if (this.params.lang === 'py3') {
@@ -536,6 +538,8 @@ ExecutionVisualizer.prototype.render = function() {
536538
if (this.params.lang !== undefined) {
537539
if (this.params.lang === 'js') {
538540
this.domRoot.find('#langDisplayDiv').html('JavaScript');
541+
} else if (this.params.lang === 'ts') {
542+
this.domRoot.find('#langDisplayDiv').html('TypeScript');
539543
} else if (this.params.lang === 'java') {
540544
this.domRoot.find('#langDisplayDiv').html('Java');
541545
} else if (this.params.lang === 'py2') {
@@ -3602,7 +3606,7 @@ ExecutionVisualizer.prototype.redrawConnectors = function() {
36023606

36033607

36043608
ExecutionVisualizer.prototype.getRealLabel = function(label) {
3605-
if (this.params.lang === 'js') {
3609+
if (this.params.lang === 'js' || this.params.lang === 'ts') {
36063610
if (label === 'list') {
36073611
return 'array';
36083612
} else if (label === 'instance') {

0 commit comments

Comments
 (0)