我正在制作一个列表视图(android)点击时调用什么函数。
和I want to get function is async or sync。
在异步时阻塞。
甚至我也想知道how attach async mark to kotlin lambda expression。
class FunctionCaller_Content(text: List<String>,
val function: List< /*suspend? @async? */
( () -> Unit )?
>? = null)
/* I want both of async, sync function. */
{
fun isAsnyc(order: Int): Boolean
= // how to get this lambda expression{function?.get(order)} is async?
fun call(callerActivity: Activity, order: Int) {
val fun = function?.get(order)
fun()
if(isAsync(fun))
/* block click for …Run Code Online (Sandbox Code Playgroud) 我正在研究aws lambda-lex,我发现用node.js编写了咖啡机器人示例代码。
// --------------- Main handler -----------------------
// --------------- in node.js -----------------------
// Route the incoming request based on intent.
// The JSON body of the request is provided in the event slot.
exports.handler = (event, context, callback) => {
try {
dispatch(event, (response) => callback(null, response));
} catch (err) {
callback(err);
}
};
Run Code Online (Sandbox Code Playgroud)
我想使用回调参数,但在python中找不到
// --------------- Main handler -----------------------
// --------------- in python -----------------------
def lambda_handler(event, context):
dispatch(event)
# >>> this handler doesn't include callback <<<
Run Code Online (Sandbox Code Playgroud)
如果需要,将两者进行比较
python文档 vs …