added Download node

This commit is contained in:
tamat
2019-08-16 21:15:30 +02:00
parent 3612a46c77
commit 3bb18b7a1a

View File

@@ -715,7 +715,8 @@
function DownloadData() {
this.size = [60, 30];
this.addInput("value", 0, { label: "" });
this.addInput("data", 0 );
this.addInput("download", LiteGraph.ACTION );
this.properties = { filename: "data.json" };
this.value = null;
var that = this;
@@ -752,6 +753,11 @@
setTimeout( function(){ URL.revokeObjectURL( url ); }, 1000*60 ); //wait one minute to revoke url
}
DownloadData.prototype.onAction = function(action, param) {
var that = this;
setTimeout( function(){ that.downloadAsFile(); }, 100); //deferred to avoid blocking the renderer with the popup
}
DownloadData.prototype.onExecute = function() {
if (this.inputs[0]) {
this.value = this.getInputData(0);