Skip to content

Commit

Permalink
Note the semantic issue around getAll()
Browse files Browse the repository at this point in the history
  • Loading branch information
slightlyoff committed Feb 20, 2014
1 parent 1c869a5 commit a1bbd77
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
13 changes: 10 additions & 3 deletions service_worker.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ var __extends = this.__extends || function (d, b) {
__.prototype = b.prototype;
d.prototype = new __();
};

// Semi-private to work around TS. Not for impl.
var _RegistrationOptionList = (function () {
function _RegistrationOptionList() {
Expand All @@ -18,6 +19,7 @@ var _RegistrationOptionList = (function () {
return _RegistrationOptionList;
})();


var ReloadPageEvent = (function (_super) {
__extends(ReloadPageEvent, _super);
function ReloadPageEvent() {
Expand Down Expand Up @@ -117,6 +119,7 @@ var InstallEvent = (function (_super) {
return InstallEvent;
})(InstallPhaseEvent);


// The scope in which worker code is executed
var ServiceWorkerGlobalScope = (function (_super) {
__extends(ServiceWorkerGlobalScope, _super);
Expand Down Expand Up @@ -199,9 +202,9 @@ var OpaqueResponse = (function (_super) {
_super.apply(this, arguments);
}
Object.defineProperty(OpaqueResponse.prototype, "url", {
get: // This class represents the result of cross-origin fetched resources that are
// This class represents the result of cross-origin fetched resources that are
// tainted, e.g. <img src="http://cross-origin.example/test.png">
function () {
get: function () {
return "";
},
enumerable: true,
Expand Down Expand Up @@ -328,7 +331,7 @@ var FetchEvent = (function (_super) {
// you can do something async (like fetch contents, go to IDB, whatever)
// within whatever the network time out is and as long as you still have
// the FetchEvent instance, you can fulfill the request later.
this.client = null;
this.client = null; // to allow postMessage, window.topLevel, etc
}
// * If a Promise is provided, it must resolve with a Response, else a
// Network Error is thrown.
Expand Down Expand Up @@ -392,12 +395,14 @@ var Cache = (function () {
for (var _i = 0; _i < (arguments.length - 0); _i++) {
urls[_i] = arguments[_i + 0];
}
// Note that items may ONLY contain Response instasnces
if (urls.length) {
// Begin fetching on the URLs and storing them in this.items
}
}
// "any" to make the TS compiler happy:
Cache.prototype.match = function (name) {
// name matches something in items
if (name) {
return this.items.get(name.toString());
}
Expand Down Expand Up @@ -500,6 +505,7 @@ var BroadcastChannel = (function () {
})();
;


var WorkerGlobalScope = (function (_super) {
__extends(WorkerGlobalScope, _super);
function WorkerGlobalScope() {
Expand Down Expand Up @@ -555,6 +561,7 @@ var _URL = (function () {
return _URL;
})();


// the TS compiler is unhappy *both* with re-defining DOM types and with direct
// sublassing of most of them. This is sane (from a regular TS pespective), if
// frustrating. As a result, we describe the built-in Event type with a prefixed
Expand Down
2 changes: 2 additions & 0 deletions service_worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ class _RegistrationOptionList implements RegistrationOptionList {
interface ServiceWorkerContainer {
active?: ServiceWorker; // can be null

// FIXME: what's the semantic?
// https://github.com/slightlyoff/ServiceWorker/issues/170
getAll(): Promise; // Promise<Array<ServiceWorker>>

ready(): Promise; // Promise<ServiceWorker>
Expand Down

0 comments on commit a1bbd77

Please sign in to comment.