How to execute code synchronously.?

This is the code, onHighlightsCaptured event is not getting invoked, Instead of calling turnOnCapture method, If i include overwolf.media.replays.turnOn here, It is getting invoked. Is it because of asynchronous behaviour? May I know how to make it synchronous?

    this.turnOnCapture(); 
    overwolf.media.replays.onHighlightsCaptured.addListener(function(info) { 
overwolf.extensions.io.writeTextFile(overwolf.extensions.io.enums.StorageSpace.pictures,"onHighlightsCaptured",JSON.stringify(info,null,2),
    console.log); });

public turnOnCapture() {
overwolf.media.replays.turnOn({
“highlights” : {
“enable” : true,
“requiredHighlights” : [“kill”] },
“settings” : {
“gif_as_video”: false,
“max_quota_gb” : 2,
“video” : {
“sub_folder_name” : “C:\Users\91994\Videos\Overwolf”,
“auto_calc_kbps”:true,
“fps” :30,
“width” :1920,
“height” : 1080,
“max_kbps” : 100,
“buffer_length”:3000,
“frame_interval”: 30,
“test_drop_frames_interval”:100,
“notify_dropped_frames_ratio”: 30,
“max_file_size_bytes” : 10000000,
“include_full_size_video” : false,
“override_overwolf_setting”:true,
“disable_when_sht_not_supported” : false ,
“indication_position”: overwolf.streaming.enums.IndicationPosition.BottomLeftCorner,
“indication_type”:overwolf.streaming.enums.IndicationType.DotAndTimer,
“use_app_display_name” : false
}
}
}, console.log);
}

Hi, and thanks for the feedback.

We will check the issue and we will update you here.

Thanks.

It would be great that if I get an update on this soon

Have you tried to register to the onHighlightsCaptured event BEFORE calling overwolf.media.replays.turnOn()?

I have tried that too.
It’s not the case only for this scenario. Code runs asynchronously. How to make it line by line execution