Skip to content

Does hostobject support array from JavaScript #1440

Open
@yangzhongke

Description

@yangzhongke

My code in C#

[ComVisible(true)]
public class JavaScriptBridge
{
	public int Sum(int[] items)
	{
		return items.Sum();
	}
}

My Coe in JavaScript:

alert(await bridge.Sum([3, 5, 8]));

But it didn't work.
image

I understand that I can work around this issue by using JSON.stringify() to convert an array in JavaScript to a plain string, and pass it to JavaScriptBridge. I just want to know whether there is a more graceful approach?
Thanks.

AB#34069027

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtrackedWe are tracking this work internally.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions