4
我今天遇到了一些非常奇怪的應用程序行爲: 我有這個函數來創建表,然後,當成功時,繼續執行代碼。多次觸發事務回調
db.transaction(function (tx) {
tx.executeSql('CREATE TABLE IF NOT EXISTS newsDetail(id unique, title, text, created, createdTS, imageSmall, imageBig, facebook, gameNumber)');
tx.executeSql('CREATE TABLE IF NOT EXISTS lastModified(id unique, ts)');
tx.executeSql('CREATE TABLE IF NOT EXISTS teams(pos unique, name, games, gd, points, s, snv, gl, glo, goals)');
tx.executeSql('CREATE TABLE IF NOT EXISTS players(number unique, name, nickname, birthdate, height, married, children, profession, clubs, position, image)');
tx.executeSql('CREATE TABLE IF NOT EXISTS games(id unique, home, away, score, date, shortDate)');
tx.executeSql('CREATE TABLE IF NOT EXISTS galleryCategories(id unique, name, date, thumb, ordering)');
tx.executeSql('CREATE TABLE IF NOT EXISTS galleryImages(id unique, url, description, catid, ordering)');
tx.executeSql('CREATE TABLE IF NOT EXISTS videos(id unique, url, title, image)');
}, errorCB, function() {
loadData('newslist', createNewslist, true);
loadData('refresh', loadNewOnes, true);
});
現在的問題是,Succes回調函數被調用8次。這是爲什麼?我已經使用這段代碼幾個月了,以前從未遇到過這個問題。有沒有人遇到類似的事情呢?任何幫助表示讚賞。