Returning data from javascript call

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By andy_

Hi all, So i have been using Godot for a few days now and i like it. I am developing a web based app that allows the user to open file from the local file system. Since Godot does not support this, i though about using javascript to open the file and pass the contents to godot. This is what i have so far:

extends Control

func _on_Button_pressed():
var content = JavaScript.eval("""
	var input = document.createElement('input');
	input.type = 'file';
	input.onchange = e => { 
		var file = e.target.files[0]; 
		var reader = new FileReader();
		reader.readAsText(file,'UTF-8');
		reader.onload = readerEvent => {
		var filecontent = readerEvent.target.result; // this is the content!
		}
	}
	input.click();
""")

My problem is how to get the content from javascript back to godot.

:bust_in_silhouette: Reply From: andy_

sorry, i posted twice