HERE-API 使用 eval 和新函数

HERE-API using eval and New Function

有没有什么方法可以在不使用 evalnew Function 语句的情况下使用 Here API?

(因为这种语句在某些环境下会被屏蔽)

我相信这个问题是 HERE JavaScript API 特有的。例如,来自 mapsjs-core.js 第 154 行,否则将被最小化和混淆:

function(){eval("var self = arguments[0];"+b)}

我不打算争论 eval('...')new Function('...') 是否是 evil/bad 实践,因为问题的含义是它们的使用在某些环境中无论如何都会被阻止。

由于这是 JavaScript API 的当前实现,另一种方法是使用可能有用的示例 HERE REST API directly for whichever services you need. You will need to handle Ajax requests without the convenience of the JavaScript SDK, but for some libraries and frameworks it may be necessary to have that level of control anyway. We've recently published some blog posts demonstrating this with React, Angular, and Vue