Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
constructor(
private service: TranslocoService,
@Inject(TRANSLOCO_PERSIST_LANG_STORAGE) private storage: PersistStorage,
@Inject(TRANSLOCO_PERSIST_LANG_CONFIG) private config: PersistLangConfig
) {
this.storageKey = config.storageKey || 'translocoLang';
if (isBrowser()) {
this.init();
}
}
clear() {
isBrowser() && this.storage.removeItem(this.storageKey);
}
getCachedLang(): string | null {
return isBrowser() ? this.storage.getItem(this.storageKey) : null;
}