- Messages
- 531
- Country
I am trying to read traffic information from MSFS and I use the Coherent.call("GET_AIR_TRAFFIC") that is used by Asobo and all mods.
As I am not very familiar with using Promises in JavaScript, I wrote a very simple code to test it was OK, something like this:
As you see, it is extremely simple and just shows the number of airplanes found in the traffic, nothing more.
Unfortunately, whatever I do, I never get anything to show in the console, not only to say that 0 airplane were found. I just have nothing, as if my code was never executed because the promise is rejected.
Does any of you can tell me if something is wrong in my code?
Thanks,
Eric
As I am not very familiar with using Promises in JavaScript, I wrote a very simple code to test it was OK, something like this:
Coherent.call("GET_AIR_TRAFFIC").then((obj) => {
console.log("TRAFFIC : " + obj.length + " airplanes found");
});
As you see, it is extremely simple and just shows the number of airplanes found in the traffic, nothing more.
Unfortunately, whatever I do, I never get anything to show in the console, not only to say that 0 airplane were found. I just have nothing, as if my code was never executed because the promise is rejected.
Does any of you can tell me if something is wrong in my code?
Thanks,
Eric