Created
June 24, 2016 14:48
-
-
Save shibayu36/c5cc72d0daaf64e4ee992535e6fc8089 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
class FakeStorage implements Storage { | |
length: number; | |
[key: string]: any; | |
[index: number]: string; | |
constructor() { | |
this.length = 0; | |
} | |
getItem(key: string): any { | |
return this[key]; | |
} | |
setItem(key: string, data: string): void { | |
this[key] = data; | |
this.length++; | |
} | |
removeItem(key: string): void { | |
delete this[key]; | |
this.length--; | |
} | |
key(index: number): string { | |
// not implement | |
return 'dummy'; | |
} | |
clear(): void { | |
// not implement | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment