Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specify Transferable Objects #13

Open
chrism6475 opened this issue Feb 8, 2018 · 0 comments
Open

Specify Transferable Objects #13

chrism6475 opened this issue Feb 8, 2018 · 0 comments

Comments

@chrism6475
Copy link

Is there a way to modify the post message to include the list of transferable objects. I've changed the create Promise for worker function to specify the transferable object as such:

private createPromiseForWorker<T>(worker: Worker, data: any) {
    return new Promise<T>((resolve, reject) => {
        worker.addEventListener('message', (event) => resolve(event.data));
        worker.addEventListener('error', reject);
        worker.postMessage(data, [data]); //add transferable object
    });
}

However, this method produces a data clone error in the console.

I'm trying to send an array of images to my main thread, so any ideas on how to support this functionality would be great.

Thanks.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant