WebSQL operation runs in the console, not in code
I am trying to write a Sencha Touch 2.0 WebSql proxy that supports tree data. I started with tomalex0 WebSql / Sqlite proxy. https://github.com/tomalex0
While modifying the script, I ran into a strange debugging problem:
(I am using Chrome 17.0.963.78m)
The next cut ones just jumped over. The deal will never go through! But when I set a breakpoint above or below and I run the same code in the console, it works!
dbConn.transaction(function(tx){
console.log(tx);
if (typeof callback == 'function') {
callback.call(scope || me, results, me);
}
tx.executeSql(sql, params, successcallback, errorcallback);
});
The blue log you see, the green log is from the success handler. When the query is executed, there will be exactly the same log above (this is SELECT * FROM ..., so when executed multiple times without changing the data, I would expect the same result)
I found out that when I add a block of code to the clock expressions, it runs as well.
source to share
This is not skipped. Planned, but not executed until much later due to the asynchronous nature of the request:
http://ejohn.org/blog/how-javascript-timers-work/
Since the code is executed synchronously in order to make an asynchronous call, it will delay the call until the synchronous code is executed due to a single javascript thread.
source to share