我需要帮助来配置我的浏览器以使用跟踪编译器。我已经尝试了几种方法来让一个简单的异步代码工作,但还没有成功。代码如下:
<!DOCTYPE html>
<html>
<body>
<h1 id="message"></h1>
<script src="https://google.github.io/traceur-compiler/bin/traceur.js"></script>
<script src="https://google.github.io/traceur-compiler/src/bootstrap.js"></script>
<script type="module">
$traceurRuntime.options = traceur.util.Options.experimental();
console.log("t", traceur, "tr", $traceurRuntime, "tro", $traceurRuntime.options);
function changeTest(text) {
return new Promise().resolve(text+text);
}
async function run(text) {
var newText = await encrypt(text);
}
console.log(run("asdf"));
</script>
</body>
</html>
traceur 编译器链接显示它应该可以工作在这里。
出现以下错误:
["file:///.../traceur_inline_script_1.js:8:8: 需要分号", "file:///.../traceur_inline_script_1.js:9:9: 需要分号"]
tracerRuntimeOptions 看起来不错:
Options {
arrowFunctions: true,
blockBinding: true,
classes: true,
computedPropertyNames: true,
defaultParameters: true…
}
annotations: true
arrayComprehension: true
arrowFunctions: true
asyncFunctions: true
asyncGenerators: true
atscript: (...)
blockBinding: true
classes: true
commentCallback: false
computedPropertyNames: true
debug: false
debugNames: false
defaultParameters: true
destructuring: true
experimental: (...)
exponentiation: true
exportFromExtended: true
forOf: true
forOn: true
freeVariableChecker: false
generatorComprehension: true
generators: true
inputSourceMap: false
lowResolutionSourceMap: false
memberVariables: true
moduleName: "default"
modules: (...)
modules_: "bootstrap"
numericLiterals: true
outputLanguage: "es5"
parseOptions: Object
properTailCalls: true
propertyMethods: true
propertyNameShorthand: true
referrer: ""
require: true
restParameters: true
script: false
sourceMaps: (...)
sourceMaps_: false
sourceRoot: false
sourceRoot_: false
spread: true
symbols: true
templateLiterals: true
transformOptions: Object
typeAssertionModule: null
typeAssertions: false
types: true
unicodeEscapeSequences: true
unicodeExpressions: true
validate: false
__proto__: Options
我尝试了几种变体,但还没有成功。有人可以帮我写一个工作代码吗?
提前致谢。