Toolbar Javascript Interoperability

Good day all,

A lot of us want to run javascript in a general fashion without running on aircraft avionics. One of the ways of doing this is running code in the toolbar by overriding Toolbar.html/.js files. This prevents multiple addons from doing the same simultaneously.

We have worked on a solution that should enable interoperability of the toolbar across multiple addons, but this requires everyone to be on-board with it. We have made this project open source with a well-documented Readme file.

Any feedback is appreciated, we want to strike when the iron is hot and solidify the code before everyone starts using it.

Hopefully this can spark ideas and enable concepts that haven’t been seen yet!

Technical Director at //42


This is a genius move! Thank you for sharing!


This looks great. Very clever solution to get loaded!

I gave the sample a go and observed that while the icon was removed, you still see it in the overflow menu, and toggling it there will create a blank icon on the main toolbar.

I believe this will suppress that:

const customize_toolbar_button = toolbar.querySelector('toolbar-customization-element[panel-id="PANEL_INTEROP_EXAMPLE"]'); = 'none';

Another thought is that html_ui/Pages/Toolbar/toolbar_interop.js is actually a VFS conflict. Would it be better if everybody carried their own copy? That means at worst you’d have older incorrect interop logic (but still common data stored on window) but not override it for everybody. Neither option is that great though. Maybe it’s best if something wins.


For the icon showing in the overflow, it probably would be pretty complex to have it removed from there also. This could also serve as a way to debug and temporarily disable the code if they are having issues. Any code to further hide it could be implemented without conflicts.

The toolbar_interop.js are intended to override each other because in the end, only one can be loaded in the toolbar at any given time. We need to make sure everyone is not loading a custom one with different names and logic. By having the same path, the loader code will only load it once. The last package wins but that also means we can all point fingers if someone is not using it properly.

1 Like

Great idea, will definitely take a look at it!

1 Like