[ServiceWorker] Send a changelog to the UA (#650)

One of the successful bits of the App Store model is the "Updated" tab.  This should be replicated in SWs, which I think will quickly become the "native" layer of the Web, and should appropriate all the advantages of native apps.

**Why it this good**

Changelogs functionality is incredibly valuable for developers, who get to remind users that a) they are always working for the users' (free) benefit and b) their software exists.

**The App Store's update signaling works as follows:**

* A badge appears on the App Store icon

* All app updates are aggregated and sorted by the time of update installation.

* The updated app's icon, new version, update size, and update date are visible.  Note that the latter is different from the prior-mentioned "time of update installation."  The concept of a separate installation date and update "submission" date is probably moot in the current SW lifecycle, but it's something to note as useful here.

* The changelog is presented.  From a user relationship standpoint, this can be a magical way to illustrate how hard you've been working for them.  Technically, it can be a mess.  In the App Store, this content is plaintext, which produces the problem of egregiously non-standard results.  For example, here are samples of bullet lists from changelogs for my app updates from only the past week:

```
1. Foo
2. Bar
3. Baz
```
```
∙    Foo
∙    Bar
∙    Baz
```
```
• Foo
• Bar
• Baz
```
```
- Foo
- Bar
- Baz
```
```
* Foo
* Bar
* Baz
```

**Implementation Straw**

* A mechanism to serve changelog text to the UA.  It should probably come as a manifest-style object.

* Changelog description using **CommonMark**.  Although Markdown is more of a family friend to the Web platform, it suits this use case better than HTML.  Template strings are nice to have here.

```javascript
let changelog = {
  "version": newVersion,
  "description":
    `* **Foo** - Lorem ipsum

    * Bar

    * Baz`
};
```

* The dates and filesize data points like those in the App Store can and must be calculated by the UA directly, for complete accuracy.

* Sending the changelog to the UA is the part that requires some finesse.  Since this is a straw, I won't worry about that and just freestyle.

```javascript
let changelog = { ... };

self.addEventListener('install', function(event) {
  event.changeLog(changelog);
});
```

**How it gets surfaced to users**

This is something for vendors to decide how to put to good use.  I would personally have a section in the download manager UI, as well as a notification indicator associated with the favicon or address bar.  The aggregated approach that the App Store uses has the advantage of reinforcing an "ecosystem" feel, as well as saving the user's time.

Looking forward to discussion, thanks for taking a look.

---
Reply to this email directly or view it on GitHub:
https://github.com/slightlyoff/ServiceWorker/issues/650

Received on Wednesday, 11 March 2015 18:52:10 UTC