portnetwork_inner.html 827 B

1234567891011121314151617181920212223242526272829303132333435
  1. <!DOCTYPE html>
  2. <html>
  3. <!--
  4. Copyright 2011 The Closure Library Authors. All Rights Reserved.
  5. Use of this source code is governed by the Apache License, Version 2.0.
  6. See the COPYING file for details.
  7. -->
  8. <!--
  9. -->
  10. <head>
  11. <title>
  12. Closure Unit Tests - goog.messaging.PortNetwork iframe page
  13. </title>
  14. <script src="../../base.js"></script>
  15. <script>
  16. goog.require('goog.messaging.PortCaller');
  17. goog.require('goog.messaging.PortChannel');
  18. </script>
  19. </head>
  20. <body>
  21. <script>
  22. var peerOrigin = window.location.protocol + '//' + window.location.host;
  23. var caller = new goog.messaging.PortCaller(
  24. goog.messaging.PortChannel.forGlobalWindow(peerOrigin));
  25. caller.dial('worker2').registerService('sendToWorker1', function(msg) {
  26. msg.push('frame');
  27. caller.dial('worker1').send('sendToMain', msg);
  28. }, true);
  29. </script>
  30. </body>
  31. </html>