Skip to content

Commit

Permalink
.whenReady is now a property returning a getter
Browse files Browse the repository at this point in the history
  • Loading branch information
jungkees committed Jun 4, 2014
1 parent f593489 commit d8d7a8c
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 12 deletions.
12 changes: 6 additions & 6 deletions service_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,12 @@ interface ServiceWorkerContainer extends EventTarget {
active?: ServiceWorker; // the activating/activated worker, can be used as a controller
controller?: ServiceWorker; // the worker handling resource requests for this page

// This atribute returns a Promise that resolves with the associated SW
// object when it becomes either waiting or active worker for the document.
// (i.e., sw.state is "installed" or "activating" or "activated", and the
// promise never rejects in any case.)
whenReady: Promise; // Promise<ServiceWorker>

// FIXME: what's the semantic?
// https://github.com/slightlyoff/ServiceWorker/issues/170
getAll(): Promise; // Promise<Array<ServiceWorker>>
Expand Down Expand Up @@ -50,12 +56,6 @@ interface ServiceWorkerContainer extends EventTarget {
unregister(scope?: string): Promise; // Defaults to "*"
// Resolves with no value on success. Rejects if scope is mismatch.

// Returns a Promise that resolves with the associated SW object when it
// becomes either waiting or active worker for the document. (i.e., sw.state
// is "installed" or "activating" or "activated", and the promise never
// rejects in any case.)
whenReady(): Promise; // Promise<ServiceWorker>

onupdatefound: (ev: Event) => any;
// Fires when .installing becomes a new worker

Expand Down
12 changes: 6 additions & 6 deletions spec/service_worker/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -278,11 +278,11 @@ <h1><code>navigator.serviceWorker</code></h1>
[<a href="http://heycam.github.io/webidl/#Unforgeable">Unforgeable</a>] readonly attribute <a href="#service-worker-interface">ServiceWorker</a>? waiting;
[<a href="http://heycam.github.io/webidl/#Unforgeable">Unforgeable</a>] readonly attribute <a href="#service-worker-interface">ServiceWorker</a>? active;
[<a href="http://heycam.github.io/webidl/#Unforgeable">Unforgeable</a>] readonly attribute <a href="#service-worker-interface">ServiceWorker</a>? controller;
readonly attribute <a href="http://goo.gl/3TobQS">Promise</a>&lt;<a href="#service-worker-interface">ServiceWorker</a>&gt; whenReady;

<a href="http://goo.gl/3TobQS">Promise</a>&lt;sequence&lt;<a href="#service-worker-interface">ServiceWorker</a>&gt;?&gt; getAll();
<a href="http://goo.gl/3TobQS">Promise</a>&lt;<a href="#service-worker-interface">ServiceWorker</a>&gt; register(DOMString <var>url</var>, optional <a href="#registration-option-list-dictionary">RegistrationOptionList</a> <var>options</var>);
<a href="http://goo.gl/3TobQS">Promise</a>&lt;any&gt; unregister(DOMString? <var>scope</var>);
<a href="http://goo.gl/3TobQS">Promise</a>&lt;<a href="#service-worker-interface">ServiceWorker</a>&gt; whenReady();

// events
attribute <a href="http://goo.gl/3nnYrx">EventHandler</a> onupdatefound;
Expand Down Expand Up @@ -322,6 +322,11 @@ <h1><code>controller</code></h1>

<p><code>navigator.serviceWorker.controller</code> must return a <a href="#service-worker-interface">ServiceWorker</a> object representing the <a href="#active-worker">active worker</a> that currently handles resource requests for the document. <code>navigator.serviceWorker.controller</code> returns <code>null</code> if the current document was not <a href="#on-fetch-request-algorithm">created under a Service Worker</a> (See step 6-1 of <a href="#on-fetch-request-algorithm">_OnFetchRequest</a> algorithm) or the request is a force refresh (shift+refresh).</p>
</spec-section>
<spec-section id="navigator-service-worker-when-ready">
<h1><code>whenReady</code></h1>

<p><code>navigator.serviceWorker.whenReady</code> attribute must return a promise that resolves with the associated <a href="#service-worker"><code>ServiceWorker</code></a> object when it becomes either <a href="#waiting-worker">waiting worker</a> or <a href="#active-worker">active worker</a> for the document. That is, the <code>state</code> of the <a href="#service-worker"><code>ServiceWorker</code></a> is either <code>installed</code>, <code>activating</code> or <code>activated</code>, and the promise never rejects in any case.</p>
</spec-section>
<spec-section id="navigator-service-worker-getAll">
<h1><code>getAll()</code></h1>

Expand All @@ -337,11 +342,6 @@ <h1><code>unregister()</code></h1>

<p><code>navigator.serviceWorker.unregister(scope)</code> method must run the <a href="#unregistration-algorithm">Unregistration algorithm</a> passing <var>scope</var> as the argument.</p>
</spec-section>
<spec-section id="navigator-service-worker-when-ready">
<h1><code>whenReady()</code></h1>

<p><code>navigator.serviceWorker.whenReady()</code> method must return a promise that resolves with the associated <a href="#service-worker"><code>ServiceWorker</code></a> object when it becomes either waiting or current worker for the document. That is, the <code>state</code> of the <a href="#service-worker"><code>ServiceWorker</code></a> is either <code>installed</code>, <code>activating</code> or <code>activated</code>, and the promise never rejects in any case.</p>
</spec-section>
<spec-section id="navigator-service-worker-onupdatefound">
<h1><code>onupdatefound</code></h1>

Expand Down

0 comments on commit d8d7a8c

Please sign in to comment.