如何在条件或等效条件下执行等待操作。

编程入门 行业动态 更新时间:2024-10-25 14:31:35
本文介绍了如何在条件或等效条件下执行等待操作。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧! 问题描述

大家好。 我一直在使用SQLiteWinRT库,我无法实现(据我所知)在javascript的bucles中工作的异步操作的等效性。 这是一个例子:

Hi everybody. I've been working with SQLiteWinRT library and there's no way I can't implement (the far I know) the equivalence of async operation working in bucles for javascript. Here is an example:

await db.OpenAsync(SQLiteWinRT.SqliteOpenMode.OpenRead); var stmt = await db.PrepareStatementAsync( "SELECT name FROM sqlite_master WHERE type = 'table'" ); //this is the part while ( await stmt.StepAsync() ) { string table = stmt.GetTextAt(0); this.ViewModel.DatabaseTables.Add(table); }

我希望能做正确的问题。

I hope to be doing the right question.

推荐答案

我发现了我自己的解决方案。我希望这可以帮助某人 I've found the solution by myself . I hope this can help someone stmt.stepAsync().then(function(r) { if (r) { var obj = {}, i = -1; while (++i < stmt.columnCount) { obj[stmt.getColumnName(i)] = stmt.getTextAt(i); } arr.push(obj); stmt.stepAsync().then(arguments.callee); } else { console.log(arr); } })

更多推荐

如何在条件或等效条件下执行等待操作。

本文发布于:2023-11-01 18:41:44,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1550101.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:条件下   条件   操作   如何在

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!