mirror of
https://github.com/ionic-team/ionic-framework.git
synced 2025-08-18 19:21:34 +08:00
feat(storage): new Local and WebSQL/SQLite key value storage service
This commit is contained in:
30
ionic/storage/storage.ts
Normal file
30
ionic/storage/storage.ts
Normal file
@ -0,0 +1,30 @@
|
||||
/**
|
||||
* 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");
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user