Skip to content

Commit 6872882

Browse files
committed
support es6 syntax in code/data editor
1 parent fe7d899 commit 6872882

File tree

7 files changed

+31
-6
lines changed

7 files changed

+31
-6
lines changed

index.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,9 @@ <h3>
9090
<a href="https://github.com/chartjs/Chart.js">
9191
<button class="indent">chartjs/Chart.js</button>
9292
</a>
93+
<a href="https://github.com/Daniel15/babel-standalone">
94+
<button class="indent">Daniel15/babel-standalone</button>
95+
</a>
9396
<a href="https://github.com/showdownjs/showdown">
9497
<button class="indent">showdownjs/showdown</button>
9598
</a>
@@ -147,6 +150,7 @@ <h3>
147150
<script src="public/lib/showdown.min.js"></script>
148151
<script src="public/lib/ace/ace.js"></script>
149152
<script src="public/lib/ace/ext-language_tools.js"></script>
153+
<script src="public/lib/babel.min.js"></script>
150154
<script src="public/lib/sigma/sigma.min.js"></script>
151155
<script src="public/lib/sigma/plugins/sigma.plugins.dragNodes.min.js"></script>
152156
<script src="public/lib/Chart-2.1.3.min.js"></script>

js/editor/executor.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ const execute = (tracerManager, code, dataLines) => {
99
lines.forEach((line, i) => {
1010
newLines.push(line.replace(/(.+\. *_wait *)(\( *\))/g, `$1(${i - dataLines})`));
1111
});
12-
eval(newLines.join('\n'));
12+
eval(Babel.transform(newLines.join('\n'), {presets: ['es2015']}).code);
1313
tracerManager.visualize();
1414
} catch (err) {
1515
return err;

public/algorithm_visualizer.js

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/algorithm_visualizer.min.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

public/lib/babel.min.js

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy