Skip to content

Commit

Permalink
[e] (0) Drop obsolete example that uses WebSQL. If anyone wants to wr…
Browse files Browse the repository at this point in the history
…ite an IndexDB replacement for this example, mail it in!

Affected topics: HTML, Web Workers

git-svn-id: http://svn.whatwg.org/webapps@6952 340c8d12-0b0e-0410-8428-c7bf67bfef74
  • Loading branch information
Hixie committed Jan 31, 2012
1 parent 0bb8b58 commit 671d6d2
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 145 deletions.
65 changes: 9 additions & 56 deletions complete.html
Expand Up @@ -992,11 +992,10 @@ <h2 class="no-num no-toc">Living Standard &mdash; Last Updated 31 January 2012</
<li><a href=#examples-4><span class=secno>9.1.2 </span>Examples</a>
<ol>
<li><a href=#a-background-number-crunching-worker><span class=secno>9.1.2.1 </span>A background number-crunching worker</a></li>
<li><a href=#a-worker-for-updating-a-client-side-database><span class=secno>9.1.2.2 </span>A worker for updating a client-side database</a></li>
<li><a href=#worker-used-for-background-i/o><span class=secno>9.1.2.3 </span>Worker used for background I/O</a></li>
<li><a href=#shared-workers-introduction><span class=secno>9.1.2.4 </span>Shared workers introduction</a></li>
<li><a href=#shared-state-using-a-shared-worker><span class=secno>9.1.2.5 </span>Shared state using a shared worker</a></li>
<li><a href=#delegation><span class=secno>9.1.2.6 </span>Delegation</a></ol></li>
<li><a href=#worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</a></li>
<li><a href=#shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</a></li>
<li><a href=#shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</a></li>
<li><a href=#delegation><span class=secno>9.1.2.5 </span>Delegation</a></ol></li>
<li><a href=#tutorials><span class=secno>9.1.3 </span>Tutorials</a>
<ol>
<li><a href=#creating-a-dedicated-worker><span class=secno>9.1.3.1 </span>Creating a dedicated worker</a></li>
Expand Down Expand Up @@ -74272,55 +74271,8 @@ <h5 id=a-background-number-crunching-worker><span class=secno>9.1.2.1 </span>A b



<h5 id=a-worker-for-updating-a-client-side-database><span class=secno>9.1.2.2 </span>A worker for updating a client-side database</h5>

<p><i>This section is non-normative.</i></p>

<p>In this example, the main document spawns a worker whose only
task is to listen for notifications from the server, and, when
appropriate, either add or remove data from the client-side
database.</p>

<p>Since no communication occurs between the worker and the main
page, the main page can start the worker by just doing:</p>

<pre>&lt;script&gt;
new Worker('worker.js');
&lt;/script&gt;</pre>

<p>The worker itself is as follows:</p>

<pre>var server = new WebSocket('ws://whatwg.org/database');
var database = openDatabase('demobase', '1.0', 'Demo Database', 10240);
server.onmessage = function (event) {
// data is in the format "command key value"
var data = event.data.split(' ');
switch (data[0]) {
case '+':
database.transaction(function(tx) {
tx.executeSql('INSERT INTO pairs (key, value) VALUES (?, ?)', data[1], data[2]);
});
case '-':
database.transaction(function(tx) {
tx.executeSql('DELETE FROM pairs WHERE key=? AND value=?', data[1], data[2]);
});
}
};</pre>

<p>This connects to the server using the <code><a href=#websocket>WebSocket</a></code>
mechanism and opens the local database (which, we presume, has been
created earlier). The worker then just listens for messages from the
server and acts on them as appropriate, forever (or until the main
page is closed).</p>

<p><a href=http://www.whatwg.org/demos/workers/database-updater/page.html>View
this example online</a>. (This example will not actually function,
since the server does not actually exist and the database is not
created by this sample code.)</p>



<h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.3 </span>Worker used for background I/O</h5>
<h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74427,7 +74379,7 @@ <h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.3 </span>Worker us
<p><a href=http://www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</p>


<h5 id=shared-workers-introduction><span class=secno>9.1.2.4 </span>Shared workers introduction</h5>
<h5 id=shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74553,7 +74505,7 @@ <h5 id=shared-workers-introduction><span class=secno>9.1.2.4 </span>Shared worke
<p><a href=http://www.whatwg.org/demos/workers/shared/003/test.html>View this example online</a>.</p>


<h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.5 </span>Shared state using a shared worker</h5>
<h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74837,7 +74789,7 @@ <h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.5 </span>Share
<p><a href=http://www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</p>


<h5 id=delegation><span class=secno>9.1.2.6 </span>Delegation</h5>
<h5 id=delegation><span class=secno>9.1.2.5 </span>Delegation</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -98228,6 +98180,7 @@ <h3 class="no-num">Reflecting IDL attributes</h3>
Ian Clelland,
Ian Davis,
Ian Fette,
Ido Green,
Ignacio Javier,
Ivan Enderlin,
Ivo Emanuel Gon&ccedil;alves,
Expand Down
65 changes: 9 additions & 56 deletions index
Expand Up @@ -992,11 +992,10 @@
<li><a href=#examples-4><span class=secno>9.1.2 </span>Examples</a>
<ol>
<li><a href=#a-background-number-crunching-worker><span class=secno>9.1.2.1 </span>A background number-crunching worker</a></li>
<li><a href=#a-worker-for-updating-a-client-side-database><span class=secno>9.1.2.2 </span>A worker for updating a client-side database</a></li>
<li><a href=#worker-used-for-background-i/o><span class=secno>9.1.2.3 </span>Worker used for background I/O</a></li>
<li><a href=#shared-workers-introduction><span class=secno>9.1.2.4 </span>Shared workers introduction</a></li>
<li><a href=#shared-state-using-a-shared-worker><span class=secno>9.1.2.5 </span>Shared state using a shared worker</a></li>
<li><a href=#delegation><span class=secno>9.1.2.6 </span>Delegation</a></ol></li>
<li><a href=#worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</a></li>
<li><a href=#shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</a></li>
<li><a href=#shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</a></li>
<li><a href=#delegation><span class=secno>9.1.2.5 </span>Delegation</a></ol></li>
<li><a href=#tutorials><span class=secno>9.1.3 </span>Tutorials</a>
<ol>
<li><a href=#creating-a-dedicated-worker><span class=secno>9.1.3.1 </span>Creating a dedicated worker</a></li>
Expand Down Expand Up @@ -74272,55 +74271,8 @@ search: while (true) {



<h5 id=a-worker-for-updating-a-client-side-database><span class=secno>9.1.2.2 </span>A worker for updating a client-side database</h5>

<p><i>This section is non-normative.</i></p>

<p>In this example, the main document spawns a worker whose only
task is to listen for notifications from the server, and, when
appropriate, either add or remove data from the client-side
database.</p>

<p>Since no communication occurs between the worker and the main
page, the main page can start the worker by just doing:</p>

<pre>&lt;script&gt;
new Worker('worker.js');
&lt;/script&gt;</pre>

<p>The worker itself is as follows:</p>

<pre>var server = new WebSocket('ws://whatwg.org/database');
var database = openDatabase('demobase', '1.0', 'Demo Database', 10240);
server.onmessage = function (event) {
// data is in the format "command key value"
var data = event.data.split(' ');
switch (data[0]) {
case '+':
database.transaction(function(tx) {
tx.executeSql('INSERT INTO pairs (key, value) VALUES (?, ?)', data[1], data[2]);
});
case '-':
database.transaction(function(tx) {
tx.executeSql('DELETE FROM pairs WHERE key=? AND value=?', data[1], data[2]);
});
}
};</pre>

<p>This connects to the server using the <code><a href=#websocket>WebSocket</a></code>
mechanism and opens the local database (which, we presume, has been
created earlier). The worker then just listens for messages from the
server and acts on them as appropriate, forever (or until the main
page is closed).</p>

<p><a href=http://www.whatwg.org/demos/workers/database-updater/page.html>View
this example online</a>. (This example will not actually function,
since the server does not actually exist and the database is not
created by this sample code.)</p>



<h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.3 </span>Worker used for background I/O</h5>
<h5 id=worker-used-for-background-i/o><span class=secno>9.1.2.2 </span>Worker used for background I/O</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74427,7 +74379,7 @@ onmessage = function (event) {
<p><a href=http://www.whatwg.org/demos/workers/stocks/page.html>View this example online</a>.</p>


<h5 id=shared-workers-introduction><span class=secno>9.1.2.4 </span>Shared workers introduction</h5>
<h5 id=shared-workers-introduction><span class=secno>9.1.2.3 </span>Shared workers introduction</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74553,7 +74505,7 @@ onconnect = function(e) {
<p><a href=http://www.whatwg.org/demos/workers/shared/003/test.html>View this example online</a>.</p>


<h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.5 </span>Shared state using a shared worker</h5>
<h5 id=shared-state-using-a-shared-worker><span class=secno>9.1.2.4 </span>Shared state using a shared worker</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -74837,7 +74789,7 @@ function getMessage(event) {
<p><a href=http://www.whatwg.org/demos/workers/multiviewer/page.html>View this example online</a>.</p>


<h5 id=delegation><span class=secno>9.1.2.6 </span>Delegation</h5>
<h5 id=delegation><span class=secno>9.1.2.5 </span>Delegation</h5>

<p><i>This section is non-normative.</i></p>

Expand Down Expand Up @@ -98228,6 +98180,7 @@ if (s = prompt('What is your name?')) {
Ian Clelland,
Ian Davis,
Ian Fette,
Ido Green,
Ignacio Javier,
Ivan Enderlin,
Ivo Emanuel Gon&ccedil;alves,
Expand Down
34 changes: 1 addition & 33 deletions source
Expand Up @@ -86814,39 +86814,6 @@ dictionary <dfn>DragEventInit</dfn> : <span>MouseEventInit</span> {



<h5>A worker for updating a client-side database</h5>

<!--END dev-html--><p><i>This section is non-normative.</i></p><!--START dev-html-->

<p>In this example, the main document spawns a worker whose only
task is to listen for notifications from the server, and, when
appropriate, either add or remove data from the client-side
database.</p>

<p>Since no communication occurs between the worker and the main
page, the main page can start the worker by just doing:</p>

<pre>&lt;script>
new Worker('worker.js');
&lt;/script></pre>

<p>The worker itself is as follows:</p>

<pre>EXAMPLE workers/database-updater/worker.js</pre>

<p>This connects to the server using the <code>WebSocket</code>
mechanism and opens the local database (which, we presume, has been
created earlier). The worker then just listens for messages from the
server and acts on them as appropriate, forever (or until the main
page is closed).</p>

<p><a
href="http://www.whatwg.org/demos/workers/database-updater/page.html">View
this example online</a>. (This example will not actually function,
since the server does not actually exist and the database is not
created by this sample code.)</p>



<h5>Worker used for background I/O</h5>

Expand Down Expand Up @@ -115085,6 +115052,7 @@ if (s = prompt('What is your name?')) {
Ian Clelland,
Ian Davis,
Ian Fette,
Ido Green,
Ignacio Javier,
Ivan Enderlin,
Ivo Emanuel Gon&ccedil;alves,
Expand Down

0 comments on commit 671d6d2

Please sign in to comment.