Create dummy bomber database, no alert on background sync fail

master
Bel LaPointe 2021-02-26 23:17:53 -06:00
parent efed1ce04f
commit 326d6a60a4
1 changed files with 39 additions and 8 deletions

View File

@ -1303,12 +1303,22 @@
sync()
{
console.log("syncing to replicas: " + this.pendingSyncCount());
this.deltas.popEach((key) => {
console.log("syncing to replicas: " + key);
this.replicate(key);
});
this.writePendingSyncCount();
var n = this.pendingSyncCount();
try
{
this.deltas.popEach((key) => {
console.log("syncing to replicas: " + key);
this.replicate(key);
});
}
catch (e)
{
console.log("failed to sync: " + e);
}
finally
{
this.writePendingSyncCount();
}
}
pendingSyncCount()
@ -1319,7 +1329,7 @@
writePendingSyncCount()
{
var n = this.pendingSyncCount();
var s = "(" + n + ")";
var s = "(" + n + " items pending replication)";
if (! n)
s = ""
document.getElementById("pending").innerHTML = s;
@ -1429,6 +1439,27 @@
}
}
class Bomber extends Database {
get(key) {
throw "teehee";
}
set(key, value)
{
throw "teehee";
}
del(key)
{
throw "teehee";
}
forEach(foo)
{
throw "teehee";
}
}
class Local extends Database {
constructor()
{
@ -1467,10 +1498,10 @@
}
}
globalStorage = new NamespacedDatabase("4", new Local());
globalStorage = new MultiDatabase(
new NamespacedDatabase("A", new Local()),
new NamespacedDatabase("B", new Local()),
//new Bomber(),
);
/*