Msfssdk.js central location

msfssdk.js is used a lot, especially if you are utilising the MSFS Avionics Framework.

I also see it included in a lot of packages, which leads to a lot of issues due to differing versions floating around, package conflicts etc.

Is there a central repo where you can just include this from, like the base framework libraries for the UI or how you can pull a library in over the web via CDN with standard webdev?

Or is there some other way to pull this in from a single source of current truth?

It would alleviate a lot of potential issues.

Thanks!

The MSFS Avionics Framework is available via NPM to include in your projects: https://www.npmjs.com/package/@microsoft/msfs-sdk

We do not recommend referencing local package versions of the compiled framework (msfssdk.js in many packages, but is also bundled with avionics in other packages), as those can be different for different packages.

If you are developing an avionics plugin, you should use the Avionics Framework NPM package version that shipped with those avionics. You can see the current avionics source (and their respective package.json) for reference at GitHub - microsoft/msfs-avionics-mirror: MSFS Avionics Source Code Mirror

The Getting Started documentation (MSFS Avionics Framework | MSFS Avionics Frameworks and Instruments) on the framework docs website is a good place to start to get up and get a project rolling. Do note that while it can be used from vanilla JS without a build step, it is really intended to be used from a standard modern TS development pipeline and we definitely recommend using it in that way.

Hope that helps!
-Matt

What about the EFB API? The official sample defines @microsoft/msfs-sdk as a global external, is that what we should be doing for EFB apps?

Hello Jack,

Actually you can use whatever you want for your application, from vanilla javascript to the msfs-sdk or other alternatives as long you define the right things for efb_api.

You can use the version you want of the msfs-sdk, bundle it in your app or use it in IIFE format. It doesn’t need to be the exact same version as the efb-os or efb-api is using.

Thanks for all the suggestions.

I like the MSFS Avionics Framework approach, but my use case is a utility app so not sure it’s needed for it.
I’m also only using a small subset of the msfssdk.js, though important one (facilities and maybe FP).

Is it possible for me to strip out just the facilities code, or can it be implemented in a similar way directly using Coherent.js calls, for example?

Just seems a waste not to use msfssdk.js though, as it’s already there and working. Reinventing the wheel and all that!

@MattNischan Querying Navdata | MSFS Avionics Frameworks and Instruments specifies const diff = await session.performNearestSearch(lat, lon, distanceMeters, 25); but using the latest MSFS 2020 WTT msfssdk.js it throws an error and it seems performNearestSearch is now searchNearest Class: NearestAirportSearchSession | MSFS Avionics Frameworks and Instruments

Is this just a doc error or is there a different version in MSFS 2024 for msfssdk.js?

I don’t have access to the 2024 alpha atm so waiting on the upcoming release, and tracking issues here in anticipation.

Thanks!

That is a doc typo; it’s always been searchNearest. Thanks for raising that, and it should be fixed in a future version of the docs.

1 Like

Thanks.

How do you retrieve Heliports in MSFS 2024?
Does startNearestSearchSession(msfssdk.FacilitySearchType.Airport) include heliports seperately?
Enumeration: FacilitySearchType | MSFS Avionics Frameworks and Instruments doesn’t have a seperate category for heliports, so how do you retrieve them?

In MSFS 2020 Heliports were only returned by the AirportInfos class on the main map:

vs

ICAO Airport Facilities search
image