Вот пример использования Ionic Storage, а также список нескольких методов, которые вы можете использовать:
import { Storage } from '@ionic/storage';
// Create a new instance of Ionic Storage
const storage = new Storage();
// Set a key-value pair in the storage
storage.set('name', 'John');
// Get the value associated with a key
storage.get('name').then((value) => {
console.log(value); // Output: John
});
// Remove a key-value pair from the storage
storage.remove('name');
// Check if a key exists in the storage
storage.keys().then((keys) => {
if (keys.includes('name')) {
console.log('Key "name" exists');
} else {
console.log('Key "name" does not exist');
}
});
// Clear all data from the storage
storage.clear();
// Get the total number of keys in the storage
storage.length().then((count) => {
console.log(`Number of keys: ${count}`);
});