【问题标题】:Tabris.js playground examples do not work due to async function由于异步功能,Tabris.js 游乐场示例不起作用
【发布时间】:2020-01-03 15:11:30
【问题描述】:

我想开始使用 Tabris.js 进行编码,并尝试在 Playground 中获得一些经验。但是每个使用的例子 异步函数 asyncFunctionName(...) 没有开始。错误信息是:

Could not load main module: Error: Could not parse ./app.js:./app.js:7:
SyntaxError: Unexpected token function
async function showActionSheet() {
      ^^^^^^^^
com.eclipsesource.v8.V8ScriptCompilationException
at subscribe (./cordova.js:758:11)
at addEventListener (./cordova.js:133:34)
at _entryPoint (./cordova.js:1560:18)

像 hello.js 这样的简单示例运行良好。 tabris 开发者应用程序中提供的示例运行良好。 我做错了什么?

【问题讨论】:

    标签: javascript tabris-js


    【解决方案1】:

    比较what the Playground generateswhat's inside the app 的输出,它们肯定是不同的。原生 Android does not yet support the async/await syntax 上的 Tabris.js(但 iOS 有)。

    这看起来像是 Playground 实现中的一个错误,因此值得 open an issue 解决这个问题。同时,您还可以克隆 repo 并使用the instructions included in the snippets directory 运行 sn-ps:

    npm install -g tabris-cli
    git clone https://github.com/eclipsesource/tabris-js
    cd tabris-js/snippets
    tabris serve -m dist/actionsheet.jsx
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-07-14
      • 2018-08-25
      • 1970-01-01
      相关资源
      最近更新 更多