Debian Codegraph @

closure-library/closure/goog/messaging/testdata/portnetwork_worker2.js

raw
1 // Copyright 2011 The Closure Library Authors. All Rights Reserved.
2
3 // Use of this source code is governed by the Apache License, Version 2.0.
4 // See the COPYING file for details.
5
6 /**
7 * @fileoverview A web worker for integration testing the PortPool class.
8 *
9 * @nocompile
10 */
11
12 self.CLOSURE_BASE_PATH = '../../';
13 importScripts('../../bootstrap/webworkers.js');
14 importScripts('../../base.js');
15
16 // The provide is necessary to stop the jscompiler from thinking this is an
17 // entry point and adding it into the manifest incorrectly.
18 goog.provide('goog.messaging.testdata.portnetwork_worker2');
19 goog.require('goog.messaging.PortCaller');
20 goog.require('goog.messaging.PortChannel');
21
22 function startListening() {
23 var caller =
24 new goog.messaging.PortCaller(new goog.messaging.PortChannel(self));
25
26 caller.dial('main').registerService('sendToFrame', function(msg) {
27 msg.push('worker2');
28 caller.dial('frame').send('sendToWorker1', msg);
29 }, true);
30 }
31
32 startListening();