SAP Web IDE显示有关ES6 +功能的错误 [英] SAP Web IDE shows errors about ES6+ features

查看:67
本文介绍了SAP Web IDE显示有关ES6 +功能的错误的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

for (var items in _selectedContexts) {
  var downloadModel = __parsed[__parsed[items].toString().split("/")[1]][__parsed[items].toString().split("/")[2]];
  var length = downloadModel["Value"].length;
  var base64 = downloadModel["Value"];
  var bytes =  new Uint8Array(length);
  while (length--) {
    bytes[length] = base64.charCodeAt(length);
  }
  MessageToast.show(bytes.length);
}

如何在UI5中初始化 Uint8Array ?我总是在SAP Web IDE中收到未定义Uint8Array"的错误消息.我是否需要导入任何特殊的库?我还在使用最新的SAPUI5版本和Chrome进行测试,所以我猜应该不会有问题吗?

How can I initialize a Uint8Array in UI5? I always get "Uint8Array is not defined" in SAP Web IDE as an error message. Do I need to import any special libraries? I'm also using the latest SAPUI5 version and Chrome for testing so it shouldn't be a problem I guess?

推荐答案

是的,只要目标浏览器支持该对象,就可以忽略该消息. Uint8Array 已添加到更新的JS规范中( ECMAScript 2015 又名 ES6 ).为了使Web IDE能够理解和解析ES6,请添加 es6 到eslint环境设置:

Yes, you can ignore the message as long as your target browser supports the object. Uint8Array was added to a somewhat newer JS specification (ECMAScript 2015 aka. ES6). In order to make Web IDE understand and parse ES6, add es6 to the eslint environment settings:

  1. 转到项目设置> 代码检查> JavaScript
  2. 展开验证程序配置面板
  3. env 对象添加"es6":true :
  1. Go to Project settings > Code Checking > JavaScript
  2. Expand the Validator Configuration panel
  3. Add "es6": true to the env object:
"env": {
  "es6": true,
  "...": "..."
},

这将相应地编辑内部 .eslintrc 文件.

  • 保存设置.
  • This will edit the internal .eslintrc file accordingly.

  • Save the settings.
  • 这篇关于SAP Web IDE显示有关ES6 +功能的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆