Skip to content

[WASM] Better double (F64) support in MonoPlatform.ts #65959

@GeroL

Description

@GeroL

Is there an existing issue for this?

  • I have searched the existing issues

Is your feature request related to a problem? Please describe the problem.

I am sending many double arrays per Unmarshalled invokes to my JS functions
I saw the Blazor.platform.toUint8Array function but it seems that this is the only helper function so far

Describe the solution you'd like

It could be new APIs like toFloat(32/64)Array like here
Also some helper functions could be implemented like the ones for float (F32)

Additional context

The types for F64 support are implemented here https://github.com/dotnet/aspnetcore/blob/main/src/Components/Web.JS/@types/dotnet/dotnet.d.ts

I have now a function in javascript like this:

function toFloat64Array(array){
    const dataPtr = Blazor.platform.getArrayDataPointer(array);
    const length = Blazor.platform.getValueI32(dataPtr);
    const f64Array = new Float64Array(length);
    f64Array.set(Module.HEAPF64.subarray(dataPtr + 4, dataPtr + 4 + length));
    return f64Array;
}

I wasn't able to test it due to lack of time.

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions