Cleanup SQLitePlugin-orig.js Android, round-trip JS-CS-JS now working

This commit is contained in:
Chris Brody 2012-04-22 07:44:21 +02:00
parent 4f2c50bcc5
commit d773caafd8
2 changed files with 6 additions and 4 deletions

View File

@ -12,6 +12,7 @@
console.log e.message console.log e.message
) )
@open @openSuccess, @openError @open @openSuccess, @openError
return
SQLitePluginTransaction = (dbPath) -> SQLitePluginTransaction = (dbPath) ->
console.log "root.SQLitePluginTransaction.SQLitePluginTransaction" console.log "root.SQLitePluginTransaction.SQLitePluginTransaction"
@dbPath = dbPath @dbPath = dbPath
@ -23,6 +24,7 @@
console.log "root.SQLitePluginTransaction - this.trans_id:" + @trans_id console.log "root.SQLitePluginTransaction - this.trans_id:" + @trans_id
transaction_queue[@trans_id] = [] transaction_queue[@trans_id] = []
transaction_callback_queue[@trans_id] = new Object() transaction_callback_queue[@trans_id] = new Object()
return
root = undefined root = undefined
root = this root = this
console.log "root.SQLitePlugin" console.log "root.SQLitePlugin"
@ -49,7 +51,6 @@
PhoneGap.exec null, null, "SQLitePlugin", "close", [ @dbPath ] PhoneGap.exec null, null, "SQLitePlugin", "close", [ @dbPath ]
return SQLitePlugin
root.SQLitePlugin = SQLitePlugin root.SQLitePlugin = SQLitePlugin
get_unique_id = -> get_unique_id = ->
id = new Date().getTime() id = new Date().getTime()
@ -181,7 +182,6 @@
transaction_callback_queue[@trans_id]["error"] = errorcb transaction_callback_queue[@trans_id]["error"] = errorcb
PhoneGap.exec null, null, "SQLitePlugin", "executeSqlBatch", transaction_queue[@trans_id] PhoneGap.exec null, null, "SQLitePlugin", "executeSqlBatch", transaction_queue[@trans_id]
return SQLitePluginTransaction
root.SQLitePluginTransaction = SQLitePluginTransaction root.SQLitePluginTransaction = SQLitePluginTransaction
root.sqlitePlugin = openDatabase: (dbPath, version, displayName, estimatedSize, creationCallback, errorCallback) -> root.sqlitePlugin = openDatabase: (dbPath, version, displayName, estimatedSize, creationCallback, errorCallback) ->
version = null unless version? version = null unless version?

View File

@ -21,6 +21,7 @@
console.log(e.message); console.log(e.message);
}); });
this.open(this.openSuccess, this.openError); this.open(this.openSuccess, this.openError);
return;
} }
SQLitePlugin.prototype.transaction = function(fn, error, success) SQLitePlugin.prototype.transaction = function(fn, error, success)
@ -51,7 +52,7 @@
PhoneGap.exec(null, null, "SQLitePlugin", "close", [this.dbPath]); PhoneGap.exec(null, null, "SQLitePlugin", "close", [this.dbPath]);
} }
}; };
return SQLitePlugin; //return SQLitePlugin;
//})(); //})();
root.SQLitePlugin = SQLitePlugin; root.SQLitePlugin = SQLitePlugin;
get_unique_id = function() get_unique_id = function()
@ -83,6 +84,7 @@
console.log("root.SQLitePluginTransaction - this.trans_id:"+this.trans_id); console.log("root.SQLitePluginTransaction - this.trans_id:"+this.trans_id);
transaction_queue[this.trans_id] = []; transaction_queue[this.trans_id] = [];
transaction_callback_queue[this.trans_id] = new Object(); transaction_callback_queue[this.trans_id] = new Object();
return;
} }
SQLitePluginTransaction.queryCompleteCallback = function(transId, queryId, result) SQLitePluginTransaction.queryCompleteCallback = function(transId, queryId, result)
{ {
@ -247,7 +249,7 @@
transaction_callback_queue[this.trans_id]['error'] = errorcb; transaction_callback_queue[this.trans_id]['error'] = errorcb;
PhoneGap.exec(null, null, "SQLitePlugin", "executeSqlBatch", transaction_queue[this.trans_id]); PhoneGap.exec(null, null, "SQLitePlugin", "executeSqlBatch", transaction_queue[this.trans_id]);
}; };
return SQLitePluginTransaction; //return SQLitePluginTransaction;
//})(); //})();
root.SQLitePluginTransaction = SQLitePluginTransaction; root.SQLitePluginTransaction = SQLitePluginTransaction;