1.2.0 • Published 5 months ago

ngx-update-app v1.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
5 months ago

npm version Package License NPM Downloads Snyk stars forks HitCount

Angular directive for updating app via service workers

Angular 19 compatible

Here's the demo

  • Lightweight
  • No dependencies!
  • Directive way
  • Customizable options...

🛠️ Install

yarn add ngx-update-app

🚀 Quick start

  1. Provide config
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' })
  ]
};
  1. Use directive in root component
import { NgxUpdateAppDirective } from 'ngx-update-app';

@Component({ standalone: true, hostDirectives: [NgxUpdateAppDirective] })
export class AppComponent {}

🛠️ Options

OptionTypeDefaultDescription
intervalnumberundefinedinterval to check new version in milliseconds
dryRunbooleanfalseforce update action once on init
onUpdateFactoryfunctionundefinedfunction which will be called on update

🔧 Compatibility

Angularngx-fixed-footerInstall
>= 181.xyarn add ngx-update-app
>= 170.xyarn add ngx-update-app@0

📦 Dependencies

None

🪪 License

Copyright © 2023 - 2025 Dominik Hladik

All contents are licensed under the MIT license.

1.2.0

5 months ago

1.1.1

8 months ago

1.0.1

9 months ago

1.0.0

1 year ago

0.1.1

1 year ago

0.1.0

2 years ago

0.0.6

2 years ago

0.0.5

2 years ago

0.0.4

2 years ago