Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/celtian/ngx-update-app
Angular directive for updating app via service workers
https://github.com/celtian/ngx-update-app
angular library
Last synced: about 10 hours ago
JSON representation
Angular directive for updating app via service workers
- Host: GitHub
- URL: https://github.com/celtian/ngx-update-app
- Owner: Celtian
- License: mit
- Created: 2023-12-27T15:57:58.000Z (11 months ago)
- Default Branch: master
- Last Pushed: 2024-10-17T19:55:49.000Z (30 days ago)
- Last Synced: 2024-11-14T20:02:15.521Z (1 day ago)
- Topics: angular, library
- Language: TypeScript
- Homepage:
- Size: 1.04 MB
- Stars: 3
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
- Code of conduct: CODE_OF_CONDUCT.md
- Security: SECURITY.md
Awesome Lists containing this project
README
NgxAppVersion
[![npm version](https://badge.fury.io/js/ngx-update-app.svg)](https://badge.fury.io/js/ngx-update-app)
[![Package License](https://img.shields.io/npm/l/ngx-update-app.svg)](https://www.npmjs.com/ngx-update-app)
[![NPM Downloads](https://img.shields.io/npm/dm/ngx-update-app.svg)](https://www.npmjs.com/ngx-update-app)
[![Snyk](https://snyk.io//advisor/npm-package/ngx-update-app/badge.svg)](https://snyk.io//advisor/npm-package/ngx-update-app)
[![stars](https://badgen.net/github/stars/celtian/ngx-update-app)](https://github.com/celtian/ngx-update-app/)
[![forks](https://badgen.net/github/forks/celtian/ngx-update-app)](https://github.com/celtian/ngx-update-app/)
[![HitCount](http://hits.dwyl.com/celtian/ngx-update-app.svg)](http://hits.dwyl.com/celtian/ngx-update-app)> Angular directive for updating app via service workers
> ✓ _Angular 18 compatible_
Here's the [demo](http://celtian.github.io/ngx-update-app/)
- Lightweight
- No dependencies!
- Directive way
- Customizable [options](#options)...## 🛠️ Install
```terminal
yarn add ngx-update-app
```## 🚀 Quick start
1. Provide config
```typescript
import { provideUpdateApp } from 'ngx-update-app';export const appConfig: ApplicationConfig = {
providers: [
provideUpdateApp({
interval: 1000 * 60, // check new version every minute
dryRun: false, // set to true if zou want to see alert on init
onUpdateFactory: () => {
// you can use inject() here
return () => alert('Should update');
}
}),
provideServiceWorker('ngsw-worker.js', {
enabled: !isDevMode(),
registrationStrategy: 'registerWhenStable:30000'
})
]
};
```2. Use directive in root component
```typescript
import { NgxUpdateAppDirective } from 'ngx-update-app';@Component({
standalone: true,
hostDirectives: [NgxUpdateAppDirective]
})
export class AppComponent {}
```## 🛠️ Options
| Option | Type | Default | Description |
| ------------------- | -------- | --------- | --------------------------------------------- |
| **interval** | number | undefined | interval to check new version in milliseconds |
| **dryRun** | boolean | false | force update action once on init |
| **onUpdateFactory** | function | undefined | function which will be called on update |## 🔧 Compatibility
| Angular | ngx-fixed-footer | Install |
| ------- | ---------------- | --------------------------- |
| >= 18 | 1.x | `yarn add ngx-update-app` |
| >= 17 | 0.x | `yarn add ngx-update-app@0` |## 📦 Dependencies
_None_
## 🪪 License
Copyright © 2023 - 2024 [Dominik Hladik](https://github.com/Celtian)
All contents are licensed under the [MIT license].
[mit license]: LICENSE