Questions tagged [transferable]

Transferable objects are JavaScript objects that can be transferred from one context to another without copying the underlying data.

30 questions
40
votes
4 answers

Using transferable objects from a Web Worker

I currently have this code to create a Web Worker: w = new Worker("webwork.js"); w.onmessage = function(event) { alert(event.data); } And then the webwork.js code for the Web Worker: self.onmessage = function(event) { //var ss=r; //Causes…
alt.126
  • 1,097
  • 1
  • 9
  • 22
10
votes
1 answer

Transferable custom classes with ES6 web workers

In Javascript ES6, in the browser, I want to transfer custom class objects to a web worker using the "Transferable" interface. Is this possible? I can find documentation about this for ArrayBuffer objects, but not for custom class objects. This is…
atomickitten
  • 213
  • 2
  • 11
9
votes
1 answer

Failed to execute 'postMessage' on 'DedicatedWorkerGlobalScope': Value at index 0 does not have a transferable type

This is the code of my worker: onmessage = function (event) { postMessage({'data': event.data}, ['http://localhost:9000']); }; And this is the code where I use the worker: var worker = new Worker("/path/to/my/worker.js"); worker.onmessage =…
Cb11
  • 174
  • 1
  • 11
8
votes
1 answer

Does chrome.runtime support posting messages with transferable objects?

I am learning about Transferable Objects: http://updates.html5rocks.com/2011/12/Transferable-Objects-Lightning-Fast They seem pretty awesome and I would like to use them in my extension to speed up passing data from inside of an iframe to outside of…
Sean Anderson
  • 27,963
  • 30
  • 126
  • 237
6
votes
1 answer

Pass submited file to web worker by refference with as little overhead as possible

I will have a web worker to parse huge text file (200000 lines, simple syntax though). I expect user to submit that file wia drag'n'drop or otherwise, obtaining a File object: var work = new Worker("parser.js") …
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
5
votes
1 answer

MessageChannel port.postMessage's data is null when calling postMessage with a transferable object?

I'm learning about MessageChannel and transferable objects. I've got an iframe which is cross-domain from my page. The documentation surrounding MessageChannel indicates that it fully supports cross-domain communications. I've got this code inside…
Sean Anderson
  • 27,963
  • 30
  • 126
  • 237
2
votes
1 answer

Is there a way to create a TypedArray from an ArrayBuffer without using new keyword in Javascript?

I am using transferables to communicate between the main thread and the worker. I realized the communcation creates GC activity because after receiving the buffer, I'm converting the buffer to a typed array using the new keyword: var ary = new…
Oğuz Eroğlu
  • 103
  • 1
  • 9
2
votes
1 answer

Use transferable objects with a shared worker

When using transferable objects in my shared workers I receive null for event.data in the main thread. After some searching I found this post where is explained that the ArrayBuffer is always lost when it is passed through a MessagePort of a…
Wilt
  • 41,477
  • 12
  • 152
  • 203
2
votes
1 answer

postMessage webworker memory leak

I'm using a webworker to pass some data at an interval of 10 ms. In the task manager I can see the working memory set increasing till I don't cancel the interval. Here's what I'm doing: Sending: function send() { setInterval(function() { …
roro
  • 193
  • 3
  • 16
2
votes
1 answer

Dart Language: how to convert a String into a Transferable (ByteBuffer)

I'll be using window.postMessage("", "*", [transferableData]) to send data between two browser windows. However, I didn't find any straight answer on how to convert types into Transferables. So, in order for me to start learning this, it would be…
Felipe
  • 376
  • 2
  • 5
  • 15
1
vote
1 answer

Memory Leak: JavaScript - passing array buffer to Web Worker using transferable object, GC doesn't kick in

So, I am passing video buffer(Float32Array buffer) to worker thread as a transferable object, it happens for each frame of the video(meaning, continuously video frames are being passed to worker). I did memory profiling, and worker thread is…
1
vote
1 answer

Why can't I cast a buffered image into a transferrable object to send it to the clipboard?

I'm trying to save a bufferedImage to my system's clipboard, basically my program makes a screencapture of an area and saves it as a PNG, but now I'd like it to be able to send that image to the clipboard too, I've tried with…
fen
  • 73
  • 6
1
vote
1 answer

Three.js: How to load an animated .json model from a web-worker?

Preamble I've been banging my head against this one for almost two weeks now, and am no closer to a solution. I've asked sub-questions I thought would lead me in the right direction: Three.js - How to deserialize geometry.toJSON()? (where is…
mhelvens
  • 4,225
  • 4
  • 31
  • 55
0
votes
0 answers

Problems with draggable and dropDestination using DataRepresentation in Transferable

I can't get my drag and drop with DataRepresentation to work with Transferable. I'm trying to drag and drop instances of DataSettings which is an NSManagedObject that conforms to NSSecureCoding. Here's my UTType: extension UTType { static var…
Phantom59
  • 947
  • 1
  • 8
  • 19
0
votes
0 answers

Editable List in SwiftUI does not work with Transferable

I wrote a short program to test Transferable with a List of objects for an easy implementation of drag and drop. My list already provided movable items (taking for granted from the SwiftUI List). After I added Transferable that functionality was…
enovatia
  • 230
  • 1
  • 12
1
2