Skip to content

Adding user-defined properties to objects does not work #24

@jspanchu

Description

@jspanchu

One cannot add their own properties to the object returned be vtk.vtkClassName().

const vtk = await window.vtkReady;
const actor = vtk.vtkActor();
actor.myProperty = 1010;
console.log(actor.myProperty );

Console prints:

async(...A)=>i.decorateResult(await e.invoke(n,G(s),i.decorateArgs(A)))

because the proxy logic fails to find a C++ property myProperty on vtkActor. It assumes myProperty is a method, so it wraps around wasm.invoke.

What will help is if the object manager has API to find out if a method exists or not. I think it is not very hard to do thi.

https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Proxy/Proxy/apply might also help in combination with get.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions