0.0.2-c • Published 1 year ago

ng-webmanifest-reader v0.0.2-c

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

ng-webmanifest-reader

This package read the manifefest.json file. with angular.

Example

app.module.ts

import { NgModule } from  '@angular/core'
import { BrowserModule } from  '@angular/platform-browser'

import { AppComponent } from  './app.component'
import { NgWebmanifestReaderModule } from  'ng-webmanifest-reader'

@NgModule({
	declarations: [AppComponent],
	imports: [
		BrowserModule,
		NgWebmanifestReaderModule.forRoot()
	],
	providers: [],
	bootstrap: [AppComponent]
})
export  class  AppModule {}

app.service.ts

import { Injectable } from  '@angular/core'
import { NgWebmanifestReader, WebManifest } from  'ng-webmanifest-reader'
  

@Injectable({
providedIn: 'root',
})

export  class  WebmanifestService {
	private  manifest: WebManifest  = {}

	constructor (_service: NgWebmanifestReader) {
		_service.readCallback((data: WebManifest | null, error: any) => {
			this.loadManifest(data, error)
		})
	}

	private  loadManifest (data: WebManifest | null, error: any) {
		if (data) {
			this.manifest  =  data
		}
	}

	get  version (): string {
		if (this.manifest) {
			return  this.manifest.version  ||  ''
		} else {
			return  ''
		}
	}
}

Store Cache

This packe has store cache disable by default to anable import moldule with NgWebmanifestReaderModule.forRoot({storeCache: true})

Forked

@easy-pwa/web-manifest-reader

Author

Felipe Mateus - eufelipemateus

0.0.2-c

1 year ago

0.0.2-b

1 year ago

0.0.2-a

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago