T8522192
04/26/2024, 12:08 PMjs("const value = 5;")
it will complain missing ; before statement, is this a bug or I have some misunderstandingArtem Kobzar
04/26/2024, 12:14 PMjs function. Will it complain if you replace the const with var?T8522192
04/26/2024, 12:39 PM@JsName("audioPlay")
fun audioPlay(url: String){
js("""
var context = new AudioContext();
var source = context.createBufferSource();
var audioBuffer = await fetch(url)
.then(res => res.arrayBuffer())
.then(ArrayBuffer => context.decodeAudioData(ArrayBuffer));
source.buffer = audioBuffer;
source.connect(context.destination);
source.start();
""")
}
it will complain the same error at the line of var audioBuffer = ... , maybe it can't be assigned for functionArtem Kobzar
04/26/2024, 12:46 PMawait is also es2015+ syntaxArtem Kobzar
04/26/2024, 12:49 PMvar context = new AudioContext();
var source = context.createBufferSource();
fetch(url)
.then(function (res) { return res.arrayBuffer() })
.then(function (ArrayBuffer) { return context.decodeAudioData(ArrayBuffer) })
.then(function (audioBuffer) {
source.buffer = audioBuffer;
source.connect(context.destination);
source.start();
});turansky
04/26/2024, 1:55 PMturansky
04/26/2024, 1:56 PMAudioContext is hereturansky
04/26/2024, 1:59 PMT8522192
04/26/2024, 2:11 PMturansky
04/26/2024, 3:10 PMkotlin-browser