小编mgc*_*ion的帖子

Kotlin 中的异步匿名函数?(拉姆达表达式)

我正在制作一个列表视图(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)

lambda android asynchronous kotlin

4
推荐指数
1
解决办法
2133
查看次数

我在python lambda处理程序中找不到回调参数

我正在研究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 …

python amazon-web-services node.js aws-lambda

0
推荐指数
1
解决办法
2066
查看次数