Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(5)

Side by Side Diff: third_party/WebKit/LayoutTests/broadcastchannel/resources/worker.js

Issue 2004643002: Implement BroadcastChannel (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase on hashtraits change Created 4 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 var c;
2
3 function handler(e, reply) {
4 if (e.data.ping) {
5 c.postMessage(e.data.ping);
6 return;
7 }
8 c = new BroadcastChannel(e.data.channel);
9 let messages = [];
10 c.onmessage = e => {
11 messages.push(e.data);
12 if (e.data == 'done')
13 reply(messages);
14 };
15 c.postMessage('from worker');
16 }
17
18 onmessage = e => handler(e, postMessage);
19
20 onconnect = e => {
21 let port = e.ports[0];
22 port.onmessage = e => handler(e, msg => port.postMessage(msg));
23 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698