Breaking
Important: For a complete rundown of all breaking changes, including points not mentioned in this section, please see #10
The base Router
class no longer has an implicit dependency on the worktop/cache
module. By disassociating, developers can now choose whether or not their application(s) should interact with the Cache, allowing worktop
to now be used as a framework for authoring Service Workers – yes, for the browser!
Note: There will eventually be a
worktop/sw
module that provides Service Worker utilities. Other modules must come first, though.
In worktop@0.1.0
, the default behavior was to pass all incoming FetchEvent
s through worktop/cache
in search of a matching cache entry. To regain this behavior, please make the following changes after upgrading to worktop@0.2.0
:
import { Router } from 'worktop';
++ import { reply } from 'worktop/cache';
const API = new Router();
// ... routes
-- addEventListener('fetch', API.listen);
++ addEventListener('fetch', reply(API.run));
Or, you may choose to involve the new listen
utility, which invokes the addEventListener
call for you:
import { Router } from 'worktop';
++ import * as Cache from 'worktop/cache';
const API = new Router();
// ... routes
-- addEventListener('fetch', API.listen);
++ Cache.listen(API.run);
Features
- Add
worktop/utils
module (#8):a0123be
..4e0a0b2
- Add
worktop/crypto
module (#11): d8ee779 - Add
worktop/base64
module (#12, #14): 6695b54