[html5] r4867 - [e] (0) I am incompetent at this editing thing.
whatwg at whatwg.org
whatwg at whatwg.org
Thu Mar 25 01:18:10 PDT 2010
Author: ianh
Date: 2010-03-25 01:18:08 -0700 (Thu, 25 Mar 2010)
New Revision: 4867
Modified:
complete.html
source
Log:
[e] (0) I am incompetent at this editing thing.
Modified: complete.html
===================================================================
--- complete.html 2010-03-25 07:56:28 UTC (rev 4866)
+++ complete.html 2010-03-25 08:18:08 UTC (rev 4867)
@@ -64655,14 +64655,16 @@
<p>Here is the HTML page:</p>
<pre><!DOCTYPE HTML>
-<title>Shared workers: demo 1</title>
+<title>Shared workers: demo 2</title>
<pre id="log">Log:</pre>
<script>
var worker = new SharedWorker('test.js');
var log = document.getElementById('log');
- worker.port.onmessage = function(e) { // note: not worker.onmessage!
+ worker.port.addEventListener('message', function(e) {
log.textContent += '\n' + e.data;
- }
+ }, false);
+ worker.port.start(); // note: need this when using addEventListener
+ worker.port.postMessage('ping');
</script>
</pre>
@@ -64671,6 +64673,10 @@
<pre>onconnect = function(e) {
var port = e.ports[0];
port.postMessage('Hello World!');
+ port.onmessage = function(e) {
+ port.postMessage('pong'); // not e.ports[0].postMessage!
+ // e.target.postMessage('pong'); would work also
+ }
}
</pre>
Modified: source
===================================================================
--- source 2010-03-25 07:56:28 UTC (rev 4866)
+++ source 2010-03-25 08:18:08 UTC (rev 4867)
@@ -73070,11 +73070,11 @@
<p>Here is the HTML page:</p>
- <pre>EXAMPLE workers/shared/001/test.html</pre>
+ <pre>EXAMPLE workers/shared/002/test.html</pre>
<p>Here is the JavaScript worker:</p>
- <pre>EXAMPLE workers/shared/001/test.js</pre>
+ <pre>EXAMPLE workers/shared/002/test.js</pre>
<hr>
More information about the Commit-Watchers
mailing list