praeclarum / Ooui

A small cross-platform UI library that brings the simplicity of native UI development to the web
MIT License
1.62k stars 160 forks source link

run javascript in Wasm #236

Closed pabiagioli closed 5 years ago

pabiagioli commented 5 years ago

I have a question regarding using Xamarin.Forms with Ooui.Wasm library: One of my ideas to operate with File Uploading, besides going full multipart/form-data, was to get a URL of the file picked by doing the following:

Having this html (or something very similar) created by a Custom Renderer:

<span class="btn btn-default btn-file">
    Browse <input class="filePicker" type="file">
</span>
var file = document.getElementsByClassName("filePicker")[0].files[0];
var blobUrl = window.URL.createObjectURL(file);

blobUrl will give you something like "blob:http://localhost:9000/d7f05f4b-ea71-42f9-bc45-d43b374684b5" which you can read as a C# Stream locally and then handle it later with our more trustworthy System.Net.HttpClient

Is there a way to inject that javascript somewhere? Thanks in Advance