I wanted to use JavaScript event of Browser click path monitor. I developed one code which ultimately returning me a string.
The dilemma is, when I tried to paste that code in JavaScript event space of browser click path it throws lot of syntax error like for example,
var response = await fetch(https://someapi.com/api/);
var data = await response.json();
here it gives Missing “;” before statement
I build a code on developer console of chrome browser. It worked really well there. I generally use it as a terminal to develop and test small JScript and modify (e.g.- console.log will get change to api.info) it according to requirement of HTTP or Browser monitor.
How can I resolve above syntax errors or is it something not at all supported under JavaScript event of Browse click path monitor?
@AK Sure you can do multiple fetch calls in your single JavaScript synthetic event. Just it must finish within a reasonable time ( I think the timeout is 100 seconds for the whole JavaScript event ).
@Julius_Loman, yes all my calls could finish in < 1000ms however, my code returns [object Promise] and I’m stuck there. I tried lot of solutions from forums but none them worked.
Have you encountered in such situation and resolve it successfully.
I’m lame with JS and promises, but I guess you need something like this if I understood your requirements - fetching multiple APIs in parallel and do something with the data in a browser monitor step: