Closed tgvashworth closed 8 years ago
Idea is to rename the current fetch
callback to fetching
, then allow plugins to replace the internal fetch
implementation. They could be passed the 'next' fetch
in the chain (where the final one is our internal fetch) to call if they'd like to.
class CachePlugin {
fetch({ request, fetch }) {
if (this.isCached(request)) {
return this.get(request);
}
return fetch(request);
}
isCached(request) {
// ...
}
get(request) {
// ...
}
}
Cache and that?