Skip to content

Native Objects and External Data #6871

@bkimman

Description

@bkimman

A key usage while embedding a scripting engine in an application is to create 'native' objects.

Two types of native objects are possible:
a) those which are created by the host and exposed to the script
b) those which can be created from the script with 'new' - here the host provides a constructor function.

Typically, these objects will be backed by some memory address storing data about the object.

For (b) above, the object is created by the chakra core and so JsSetExternalData returns 'JsErrorInvalidArgument'.

So for these type of objects, what would be the recommended way to store an address containing the data .. would it be to define a readonly property in the constructor?

Also, what should the return value be of the constructor .. should it be the new object as indicated by info->thisArg or arguments[0]?

Thanks
K

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions