transferable

Custom deletion Container for Transferable and Transferhandler on JList

戏子无情 提交于 2020-01-25 06:56:05
问题 I tried to fix this issue for the past week but somehow I cant seem to find a solution. There is not a lot of information about this topic so its hard to find examples or code to look at. What I have here is a JList which uses a custom TransferHandler that creates a custom Transferable, for reference here's the code of the involved classes: Transferable: package org.dinhware.swing.special; import java.awt.datatransfer.DataFlavor; import java.awt.datatransfer.Transferable; import java.awt

Using transferable objects from a Web Worker

ⅰ亾dé卋堺 提交于 2019-12-28 09:15:28
问题 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 error because of undefined var ss=""; for(var currProp in event) { ss+=("event."+currProp+"="+event[currProp]+"\n"); } postMessage(ss); } Now I want to transfer a 128-Megabyte ArrayBuffer with this code: var r = new ArrayBuffer(1048576*128); w.postMessage(0,

Using transferable objects from a Web Worker

ε祈祈猫儿з 提交于 2019-12-28 09:15:12
问题 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 error because of undefined var ss=""; for(var currProp in event) { ss+=("event."+currProp+"="+event[currProp]+"\n"); } postMessage(ss); } Now I want to transfer a 128-Megabyte ArrayBuffer with this code: var r = new ArrayBuffer(1048576*128); w.postMessage(0,

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

走远了吗. 提交于 2019-12-23 12:39:07
问题 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") document.addEventListener("drop", function(e) { e.preventDefault(); var dt = e.dataTransfer; var files = dt.files; if(files.length>0) { var firstFile = files[0] var reader = new FileReader(); //SEND FILE TO WORKER? } }); I heard of Transferable objects. Is there a way to transfer file

Transferable custom classes with ES6 web workers

与世无争的帅哥 提交于 2019-12-23 08:45:49
问题 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 not a duplicate of How to pass custom class instances through Web-Workers? since my question is specifically about the Transferable interface. I want to pass my custom class instance to the worker without copying it. 回答1: I already addressed this

Posting Three.js meshes to web worker using javascript

不羁岁月 提交于 2019-12-13 23:50:19
问题 I have an array on objects, meshes created with Three.js, that I want to do some operations in a web worker. So the questions is how do I post them to the worker? From what I understand there's something called transferable objects that uses something called ArrayBuffer but I can't find any info about how to convert my array of objects to that. Or is this perhaps not possible? 回答1: Unless your object is already in binary buffer format, there is not performance benefit in converting it into

Set clipboard to transparent image

南楼画角 提交于 2019-12-12 05:24:38
问题 I am creating a program that needs to copy an image to clipboard. The problem is that the image has a transparent background and, whenever I copy it, the image comes out with a black background instead of transparent. I tried lots of things since 2 days ago but none worked. The class imageSelection is based on http://www.java2s.com/Tutorial/Java/0120__Development/SettinganimageontheclipboardwithacustomTransferableobjecttoholdtheimage.htm package Package1; import java.awt.Image; import java

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

你离开我真会死。 提交于 2019-12-09 06:32:02
问题 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 of my cross-domain page inside of an iframe: var messageChannel = new MessageChannel(); // Transfer port2 to the background page to establish communications. window.parent.postMessage('connect', 'chrome-extension://jbnkffmindojffecdhbbmekbmkkfpmjd',

Does chrome.runtime support posting messages with transferable objects?

江枫思渺然 提交于 2019-11-30 05:37:06
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 an iframe. I've got this example code working, but it uses a Web Worker: var s = document.createElement("script"); s.type = "text/js-worker"; s.innerHTML = 'console.log("i ran!");'; document.body.appendChild(s); var blob = new Blob(Array.prototype.map.call(document.querySelectorAll("script[type=\"text\/js-worker\"]"), function (oScript) { return

Does chrome.runtime support posting messages with transferable objects?

本秂侑毒 提交于 2019-11-29 03:27:17
问题 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 an iframe. I've got this example code working, but it uses a Web Worker: var s = document.createElement("script"); s.type = "text/js-worker"; s.innerHTML = 'console.log("i ran!");'; document.body.appendChild(s); var blob = new Blob(Array.prototype