# JS Objects as Arguments to NativeFunctions

**URL:** <https://forums.fusetools.com/t/js-objects-as-arguments-to-nativefunctions/8189>\
**Category:** How-to Discussions\
**Created:** [December 2, 2021, 5:04am UTC](https://forums.fusetools.com/t/js-objects-as-arguments-to-nativefunctions/8189 "2021-12-02T05:04:48Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![AaronLS](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/aaronls/32/1068_2.png) [@AaronLS](https://forums.fusetools.com/u/AaronLS)\
**Post date:** [December 2, 2021, 5:04am UTC](https://forums.fusetools.com/t/js-objects-as-arguments-to-nativefunctions/8189/1 "2021-12-02T05:04:48Z")

</div>

Hello, I have started using Uno.Wasm.Bootstrap to generate WASM in order to run C# client side. I.e. I’m not using the full Uno UI platform.

I was looking at the Fuse Native JS Modules examples: [Creating native JavaScript Modules in Uno - Fuse Documentation](https://fuseopen.com/docs/native-interop/native-js-modules.html)

In the example the SendMessage function receives the message in the object[] array and is cast to a string.

What if I want to be able to pass a more complex javascript object as an argument? I.e. a javascript object that has properties and methods.

Is it possible to do something like this so that I can have a handle to a JS object and interact with it?

```auto
object[] SendMessage(Fuse.Scripting.Context context, object[] args)
    {
        var jsObject = args.First() as Fuse.Scripting.Object;
        jsObject.CallMethod("someJsIObjectMethod", 123);
    }

```

---

<div class="post-metadata">

**Author:** ![Hassan\_M](https://yyz1.discourse-cdn.com/flex035/user_avatar/forums.fusetools.com/hassan_m/32/957_2.png) [@Hassan\_M](https://forums.fusetools.com/u/Hassan_M)\
**Post date:** [December 2, 2021, 2:36pm UTC](https://forums.fusetools.com/t/js-objects-as-arguments-to-nativefunctions/8189/2 "2021-12-02T14:36:20Z")

</div>

I think it can be done, take a look at this source code for reference:

> <https://github.com/fuse-open/fuselibs/blob/c66007f5133c2c46a7293acb948b23c208db828e/Source/Fuse.Scripting.JavaScript/Observable.uno#L161>

and:

> <https://github.com/fuse-open/fuselibs/blob/c66007f5133c2c46a7293acb948b23c208db828e/Source/Fuse.Scripting.JavaScript/FuseJS/Observable.js#L998>
