Changes

Jump to navigation Jump to search
m
no edit summary
Line 6: Line 6:     
// suppress console.log, switch to true for debug
 
// suppress console.log, switch to true for debug
var Debug_switch = true;
+
var Debug_switch = false;
 
 
 
// deterministic hash generator for creating user id#s from usernames, should be replaced by something more functional (guaranteed to be transitively different)
 
// deterministic hash generator for creating user id#s from usernames, should be replaced by something more functional (guaranteed to be transitively different)
Line 44: Line 44:     
this.EnqueuePDIO = async function( sw, c1, c2, c3 ) {
 
this.EnqueuePDIO = async function( sw, c1, c2, c3 ) {
 +
debuglog("enquing pdio db " + PersonalDataDataBaseName + " with user " + JSON.stringify(CurrentPerson));
 
var k = await Enquire( PersonalDataDataBaseName, this.CurrentPerson, sw, c1, c2, c3 );
 
var k = await Enquire( PersonalDataDataBaseName, this.CurrentPerson, sw, c1, c2, c3 );
 
return k;
 
return k;
Line 77: Line 78:  
var pddb = window.indexedDB.open(pddbname, 3);
 
var pddb = window.indexedDB.open(pddbname, 3);
 
var inp_obj;
 
var inp_obj;
 +
 +
pddb.onerror = function() { 
 +
    console.log("Warning: Access to IndexedDB for application has been rejected.");
 +
};
    
// indexeddb internal mechanism for version tracking of schema
 
// indexeddb internal mechanism for version tracking of schema
pddb.onupgradeneeded = function() {
+
pddb.onupgradeneeded = function(evt) {
 
console.log('upgrading database');
 
console.log('upgrading database');
 
var db = pddb.result;
 
var db = pddb.result;
Line 86: Line 91:  
// shouldn't the index be the wiki.personaldata.io username?  
 
// shouldn't the index be the wiki.personaldata.io username?  
   −
var index = store.createIndex("NameIndex", ["id"]);
+
var index = db.store.createIndex("NameIndex", ["id"]);
 
};
 
};
 
// Database successfully opened function.
 
// Database successfully opened function.
pddb.onsuccess = function() {
+
pddb.onsuccess = function(xy) {
 +
debuglog(pddb.result);
 +
debuglog(xy);
 
var db = pddb.result;
 
var db = pddb.result;
 
var tx = db.transaction(pddbname, "readwrite");
 
var tx = db.transaction(pddbname, "readwrite");
Line 99: Line 106:     
getRecord.onsuccess = function() {
 
getRecord.onsuccess = function() {
debuglog( "Record found in database: \n <<");
+
debuglog( "Record in database: \n <<");
 
debuglog( getRecord.result );
 
debuglog( getRecord.result );
 
debuglog( ">>");
 
debuglog( ">>");
Line 112: Line 119:  
// Mode 'checkin':
 
// Mode 'checkin':
 
// record is retrieved from database, parameter record is pushed if not found
 
// record is retrieved from database, parameter record is pushed if not found
if ( getRecord.result != undefined ) {
+
if ( getRecord.result !== undefined ) {
debuglog("getting from store");
+
debuglog("getting from store");
 
inp_obj = getRecord.result;
 
inp_obj = getRecord.result;
 
} else {
 
} else {
Line 125: Line 132:  
// Update & Remove from
 
// Update & Remove from
 
// If we got the record from store, use that version to be manipulated
 
// If we got the record from store, use that version to be manipulated
if ( getRecord.result != undefined ) {
+
if ( getRecord.result !== undefined ) {
 
inp_obj = getRecord.result;
 
inp_obj = getRecord.result;
 
 
530

edits

Navigation menu