Skip to content

Commit 14476bb

Browse files
committed
test: demo update
1 parent 6ff1211 commit 14476bb

File tree

1 file changed

+7
-6
lines changed

1 file changed

+7
-6
lines changed

demo/app/main-view-model.ts

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -49,16 +49,17 @@ export class HelloWorldModel extends Observable {
4949
return this.sqlite.execute(createCmd);
5050
}
5151

52-
insert(data: DataExample[]) {
53-
data.map((data, i) => {
52+
async insert(data: DataExample[]) {
53+
for (let index = 0; index < data.length; index++) {
54+
const d = data[index];
5455
const insert = 'INSERT INTO names (id, name, json) VALUES (?, ?, ?)';
5556
// Uncomment to crash it
56-
if (i === 1000) {
57+
if (index === 1000) {
5758
console.log('About to crash!');
58-
data.id = 0;
59+
d.id = 0;
5960
}
60-
this.sqlite.execute(insert, [data.id, data.name, JSON.stringify(data)]);
61-
});
61+
await this.sqlite.execute(insert, [d.id, d.name, JSON.stringify(data)]);
62+
}
6263
}
6364

6465
onInsert() {

0 commit comments

Comments
 (0)