Getting the active Flight Plan

I want to know the latest way to get the active flight plan on the G1000 loaded in sim.

I have tried the following code but it only gives me what was configured before loading the flight and doesn’t reflect any changes made after (via the avionics):

this.listener_atc = RegisterViewListener("JS_LISTENER_FLIGHTPLAN");
Coherent.call('LOAD_CURRENT_ATC_FLIGHTPLAN');
Coherent.call("GET_FLIGHTPLAN").then((flightplan_data) => {
	callback(flightplan_data);
});

I have also tried this. It doesn’t give me what’s in the avionics either:

this.listener_generic = RegisterViewListener("JS_LISTENER_FLIGHT_PLAN");
this.listener_generic.on("UpdateFlightPlan", (flightplan_data) => {
	callback(flightplan_data);
});
this.listener_generic.trigger("REQUEST_FLIGHT_PLAN");

Thank you!
Keven

1 Like

Edit:

Wrapping Coherent.call("GET_FLIGHTPLAN") in a Timeout did it.
I guess LOAD_CURRENT_ATC_FLIGHTPLAN doesn’t give us a callback to tell us when its done.

1 Like