mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 11:17:19 +08:00
31 lines
656 B
TypeScript
31 lines
656 B
TypeScript
/**
|
|
* Storage is an easy way to store key/value pairs and other complicated
|
|
* data in a way that uses the best possible storage layer underneath.
|
|
*/
|
|
export class Storage {
|
|
constructor(strategyCls: StorageStrategy) {
|
|
this._strategy = new strategyCls();
|
|
}
|
|
get(key) {
|
|
return this._strategy.get(key);
|
|
}
|
|
set(key, value) {
|
|
return this._strategy.set(key, value);
|
|
}
|
|
remove(key) {
|
|
return this._strategy.remove(key);
|
|
}
|
|
}
|
|
|
|
export class StorageStrategy {
|
|
get(key, value) {
|
|
throw Error("Not implemented");
|
|
}
|
|
set(key, value) {
|
|
throw Error("Not implemented");
|
|
}
|
|
remove(key) {
|
|
throw Error("Not implemented");
|
|
}
|
|
}
|