https://github.com/archetypicalsoftware/scaffold
Scaffold is an extensible library designed to quickly build service workers modeled after the .NET core middleware pipeline.
https://github.com/archetypicalsoftware/scaffold
extensible npm-package service-worker
Last synced: 28 days ago
JSON representation
Scaffold is an extensible library designed to quickly build service workers modeled after the .NET core middleware pipeline.
- Host: GitHub
- URL: https://github.com/archetypicalsoftware/scaffold
- Owner: ArchetypicalSoftware
- License: lgpl-3.0
- Created: 2019-03-14T20:50:55.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-01-07T20:42:02.000Z (over 3 years ago)
- Last Synced: 2025-01-08T18:15:58.528Z (over 1 year ago)
- Topics: extensible, npm-package, service-worker
- Language: TypeScript
- Homepage: https://archetypical.software/Product/Detail/Scaffold
- Size: 1.38 MB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 16
-
Metadata Files:
- Readme: README.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
Awesome Lists containing this project
README
# Scaffold

Scaffold is an library designed to quickly build service workers modeled after the .NET core middleware pipeline.
Example implementation
```ts
// service-worker.ts
import { IApplicationBuilder, Scaffold } from "@archetypical/scaffold";
import { strategies } from "swork-cache";
const offlineAssets = ["/css/site.css", "/js/site.js", "/"];
class Startup {
public configure(builder: IApplicationBuilder): void {
builder
.useInstallCache(offlineAssets)
.map(offlineAssets, strategies.backgroundFetch());
}
}
Scaffold
.createBuilder("1.0.0")
.useStartup(Startup)
.build();
```
In the example above, we were able to quickly define a list of assets that should be cached up on install of the service worker. In addition, each new request for those assets will immediately return the cached response and update the cache with the latest version in a background process.
* [Overview](readme.md)
* [IApplicationBuilder](docs/iapplication-builder.md)
* [IServiceCollection](docs/iservice-collection.md)
* [IServiceProvider](docs/iservice-provider.md)
* [IServiceWorkerBuilder](docs/iservice-worker-builder.md)
* [IApplicationLifetime](docs/iapplication-lifetime.md)
* [Startup](docs/startup.md)