“Fourrage local” Réponses codées

Localforage

// Save our users.
var users = [ {id: 1, fullName: 'Matt'}, {id: 2, fullName: 'Bob'} ];
localForage.setItem('users', users, function(result) {
    console.log(result);
});
HimansaE

Fourrage local

npm install localforage
Light Leopard

Fourrage local

try {
    const value = await localforage.getItem('somekey');
    // This code runs once the value has been loaded
    // from the offline store.
    console.log(value);
} catch (err) {
    // This code runs if there were any errors.
    console.log(err);
}
Light Leopard

Fourrage local

localforage.setItem('key', 'value', function (err) {
  // if err is non-null, we got an error
  localforage.getItem('key', function (err, value) {
    // if err is non-null, we got an error. otherwise, value is the value
  });
});
Light Leopard

Réponses similaires à “Fourrage local”

Parcourir les réponses de code populaires par langue

Parcourir d'autres langages de code