代码之家  ›  专栏  ›  技术社区  ›  solarissf

VS中async function关键字下的extjs警告/错误

  •  0
  • solarissf  · 技术社区  · 7 年前

    在Visual Studio版本14.0.25431.01更新3中,我转到文件“新SENCHA项目”。在主控制器中。JSI添加了一个简单的异步函数。我从IDE收到一条警告,在单词function下面有一条红线,表示“expected';”。代码仍能正确运行,但我正在尝试消除此错误/警告。有人知道我怎么解决这个问题吗?

    /**
     * This class is the controller for the main view for the application. It is 
    specified as
     * the "controller" of the Main view class.
     */
    Ext.define('ExtApplication1.view.main.MainController', {
      extend: 'Ext.app.ViewController',
    
      alias: 'controller.main',
    
      onItemSelected: function(sender, record) {
        Ext.Msg.confirm('Confirm', 'Are you sure?', 'onConfirm', this);
      },
    
      onConfirm: function(choice) {
        if (choice === 'yes') {
          //
          foo();
        }
      }
    });
    
    async function foo() {
      try {
        console.log(`Got the final result:`);
      } catch (error) {
        //failureCallback(error);
    
      }
    };
    

    红色的错误行在函数字下面,在async foo旁边

    0 回复  |  直到 7 年前