Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 16 additions & 12 deletions static/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,21 @@
function LitegraphApi() {
this.saveCode = function(code) {
console.log("LitegraphApi.saveCode()");
$.post(
'/api/saveCode',
{
"json": JSON.stringify({"code":code})
},
function(returnedData) {
console.log("LitegraphApi.saveCode.response()");
console.log(returnedData)
},
'json'
);
// Create a new blob object from code
var blob = new Blob([code], {type: "text/plain;charset=utf-8"});

// Create a link element
var element = document.createElement('a');

// Create a URL for the blob object
element.href = URL.createObjectURL(blob);

// Set the download attribute of the link element to the desired file name
element.download = "workflow.py";

// Programmatically trigger a click on the link to start the download
element.click();

};
this.saveWorkflow = function(workflowName) {
console.log("LitegraphApi.saveWorkflow()");
Expand Down Expand Up @@ -755,4 +759,4 @@
</script>
</body>

</html>
</html>