From 3bb18b7a1adb9415fb9b291409f6f0ae73f08cf3 Mon Sep 17 00:00:00 2001 From: tamat Date: Fri, 16 Aug 2019 21:15:30 +0200 Subject: [PATCH] added Download node --- src/nodes/base.js | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/src/nodes/base.js b/src/nodes/base.js index dd881146f..b58dc772b 100755 --- a/src/nodes/base.js +++ b/src/nodes/base.js @@ -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);