Created
November 14, 2018 12:32
-
-
Save LironHazan/a7c173bfb07965ce60d219434bb2fc0e to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import {Injectable} from '@angular/core'; | |
@Injectable() | |
export class LocalStorageWrapperStubService { | |
constructor() { } | |
private localStorage = new Map(); | |
remove(key) { | |
return this.localStorage.delete(key); | |
} | |
get(key) { | |
try { | |
return this.localStorage.get(key); | |
} catch (e) { | |
return null; | |
} | |
} | |
set(key, value) { | |
return this.localStorage.set(key, JSON.stringify(value)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment