Skip to content

Commit

Permalink
Update es6 export to use generate
Browse files Browse the repository at this point in the history
  • Loading branch information
Flamenco committed Apr 4, 2024
1 parent fcc8c48 commit 54c82ca
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions docs/js/online.js
Original file line number Diff line number Diff line change
Expand Up @@ -235,8 +235,15 @@ $(document).ready(function() {
$( "#parser-download-es6" )
.click(function(){

var blob = new Blob( ["export default " + parserSource + ";\n"], {type: "application/javascript"} );
window.saveAs( blob, "parser.js" );
// If this button was enabled, the source was already validated by 'rebuildGrammar'
const esSource = peggy.generate(editor.getValue(), {
cache: $("#option-cache").is(":checked"),
output: "source",
format: 'es'
})

var blob = new Blob([esSource], {type: "application/javascript"});
window.saveAs(blob, "parser.js");

});

Expand Down

0 comments on commit 54c82ca

Please sign in to comment.