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

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 and slightly improved tests 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
2 function handler(e, reply) {
3 let c = new BroadcastChannel(e.data.channel);
4 let messages = [];
5 c.onmessage = e => {
6 messages.push(e.data);
7 if (e.data == 'done') {
8 if (e.source)
9 e.source.postMessage(messages);
10 else
11 reply(messages);
12 }
13 };
14 c.postMessage('from worker');
15 }
16
17 onmessage = e => handler(e, postMessage);
18
19 onconnect = e => {
20 let port = e.ports[0];
21 port.onmessage = e => handler(e, msg => port.postMessage(msg));
22 };
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698