Skip to content

Add ability to Share Native Object Instances between Main and Worker Runtimes #37

@ammarahm-ed

Description

@ammarahm-ed

Both Worker and Main JS runtime instances use the same Java environment hence the native objects can be shared between the two.
Main:

const nativeObject = new java.lang.String("string");
const worker = new Worker(...);
worker.postMessage({
  myNativeString: globalThis.createNativeHandle(nativeObject)
});

Worker:

globalThis.onmessage = (message) => {
  const nativeObject = globalThis.resolveNativeHandle(message.myNativeString);
}

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions