Addon config notification

To discuss development of addons / skins / customization of MediaMonkey.

Moderators: jiri, drakinite, Addon Administrators

gexptwo
Posts: 7
Joined: Sun Sep 11, 2022 1:00 pm

Addon config notification

Post by gexptwo »

I'm new to MM Addons and the forum. Sorry if this is a duplicate but have not found an answer.
I'm writing a MM5 display Addon with config. My actions_add.js does

Code: Select all

uitools.openDialog('display', .....
My display.html references display.js which does the work when trackChange occurs.

Code: Select all

app.listen(app.player, 'playbackState', displayTrack);
I figured out config.html and config.js. Question: How do I signal the display dialog window when the addon config is updated?
In display.js I tried

Code: Select all

app.listen(app, 'settingsChange', mysettings);
But this appears to only fire when the user clicks OK on the main MM Options window, not when clicking OK on my addon settings. I checked the app API but did not see a way to send a signal/event.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Addon config notification

Post by drakinite »

You're almost there! Just do app.notifySettingsChange() in your config file on save. Example: https://github.com/ventismedia/mediamon ... /config.js
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Addon config notification

Post by drakinite »

I see that notifySettingsChange was not documented. I've added it now.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
gexptwo
Posts: 7
Joined: Sun Sep 11, 2022 1:00 pm

Re: Addon config notification

Post by gexptwo »

Looks like that works! Great thanks!
FYI on the "Getting Started (Addsons)" page (it would not let me paste URL)
under config.js example, I think

Code: Select all

        app.setValue('myAddon_config', this.state);
should be

Code: Select all

        app.setValue('myAddon_config', this.config);
drakinite
Posts: 965
Joined: Tue May 12, 2020 10:06 am
Contact:

Re: Addon config notification

Post by drakinite »

You're right, thanks for the correction! Fixed now.
Image
Student electrical-computer engineer, web programmer, part-time MediaMonkey developer, full-time MediaMonkey enthusiast
I uploaded many addons to MM's addon page, but not all of those were created by me. "By drakinite, Submitted by drakinite" means I made it on my own time. "By Ventis Media, Inc., Submitted by drakinite" means it may have been made by me or another MediaMonkey developer, so instead of crediting/thanking me, please thank the team. You can still ask me for support on any of our addons.
Post Reply