- creating Alternative to SyncManager

- fix: refreshing with FF now it works!
This commit is contained in:
Paolo Arena
2019-02-08 17:10:25 +01:00
parent 5ee0d8e171
commit b65d0a2386
18 changed files with 340 additions and 195 deletions

View File

@@ -1,24 +0,0 @@
// importScripts('/statics/js/immortal-db.min.js');
// const cfgenv = {
// website: 'http://localhost:8080',
// serverweb: 'http://localhost:3000',
// dbname: 'mydb3',
// dbversion: 10,
// }
/*
async function clearAllDataImmortal(table) {
console.log('clearAllDataImmortal', table)
const db = ImmortalDB.ImmortalDB
await db.remove(table)
}
async function writeDataImmortal(table, datavalue) {
console.log('writeDataImmortal', table, datavalue)
const db = ImmortalDB.ImmortalDB
await db.set(table, datavalue)
}
*/

View File

@@ -1,60 +1,3 @@
import objectId from "./objectId";
console.log('utility.js')
// var dbPromise = idb.open('mydb1', 1, function (db) {
// console.log('OPEN MYDB')
// if (!db.objectStoreNames.contains('todos')) {
// db.createObjectStore('todos', { keyPath: '_id' });
// }
// if (!db.objectStoreNames.contains('config')) {
// db.createObjectStore('config', { keyPath: '_id' });
// }
// });
// function readAllData(st) {
// console.log('readAllData', st);
// return dbPromise
// .then(function (db) {
// var tx = db.transaction(st, 'readonly');
// var store = tx.objectStore(st);
// return store.getAll();
// });
// }
// function clearAllData(st) {
// console.log('clearAllData', st);
// return dbPromise
// .then(function (db) {
// var tx = db.transaction(st, 'readwrite');
// var store = tx.objectStore(st);
// store.clear();
// return tx.complete;
// });
// }
// function deleteItemFromData(st, id) {
// console.log('deleteItemFromData', st, 'ID:', id);
// dbPromise
// .then(function (db) {
//
// var tx = db.transaction(st, 'readwrite');
// var store = tx.objectStore(st);
//
// try {
// store.delete(id);
// return tx.complete;
// } catch (e) {
// return false;
// }
// })
// .then(function (res) {
// if (res)
// console.log('Item deleted!');
// });
// }
function urlBase64ToUint8Array(base64String) {
var padding = '='.repeat((4 - base64String.length % 4) % 4);
var base64 = (base64String + padding)