@ng-doc/app
Version:
<!-- PROJECT LOGO --> <br /> <div align="center"> <a href="https://github.com/ng-doc/ng-doc"> <img src="https://ng-doc.com/assets/images/ng-doc.svg?raw=true" alt="Logo" height="150px"> </a>
34 lines (30 loc) • 1.32 kB
JavaScript
import * as i0 from '@angular/core';
import { inject, Injectable } from '@angular/core';
import { WA_LOCAL_STORAGE } from '@ng-web-apis/common';
const DEFAULT_SERIALIZE = (v) => String(v);
class NgDocStoreService {
constructor() {
this.localStorage = inject(WA_LOCAL_STORAGE);
}
set(key, data, serialize = DEFAULT_SERIALIZE) {
return this.localStorage.setItem(key, serialize(data));
}
get(key, deserialize) {
return deserialize
? deserialize(this.localStorage.getItem(key))
: this.localStorage.getItem(key);
}
static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgDocStoreService, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgDocStoreService, providedIn: 'root' }); }
}
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.0.6", ngImport: i0, type: NgDocStoreService, decorators: [{
type: Injectable,
args: [{
providedIn: 'root',
}]
}] });
/**
* Generated bundle index. Do not edit.
*/
export { NgDocStoreService };
//# sourceMappingURL=ng-doc-app-services-store.mjs.map