Plugins Overview
Introduction
Sometimes when building a re-usable instrument or avionics system, you may wish to allow third-parties to configure or add to the system without requiring them to fork your code. One way to do this is to use panel.xml
to define configuration options. However, what if you want to support customization that goes beyond what can be practically achieved with XML code?
The MSFS framework provides a solution in the form of the Plugins API. Plugins allow a JS/HTML instrument to load and run arbitrary Typescript/Javascript code (the plugins) while providing a convenient interface for the instrument to pass data to plugins and integrate the behavior and functionality defined by plugins as it sees fit.
If you are setting up plugin support for an instrument or avionics system, then the Adding Plugin Support For Your Instrument page will walk you through the process. If you are developing a plugin for an existing instrument, then you can opt to skip to the Creating Plugins page (though the Adding Plugin Support... page may still contain information useful for understanding the basics of the API).
Global vs. Airplane Plugins
The Plugin API supports two types of plugins: global plugins and airplane plugins. The two types are effectively identical at the code level and differ only in how they are loaded by the JS/HTML instrument.
Global plugins are plugins that apply to multiple airplanes. Generally, these will be plugins that target a specific avionics system or related family of avionics systems as opposed to a specific airplane. Global plugins are tagged for loading by XML files placed in a pre-defined common directory and served to every instrument that supports plugins. Each instrument then chooses which global plugins to use based on the target declared by the plugins.
Airplane plugins are plugins that apply to only one airplane. Airplane plugins are tagged for loading and routed to specific instruments in the airplane's panel.xml
file.
Please refer to this section for more information on loading plugins.