Sending Player info to a window

To discuss development of addons / skins / customization of MediaMonkey v5 / v2024

Modérateurs : jiri, drakinite, Addon Administrators

marceros
Messages : 36
Inscription : dim. avr. 21, 2013 1:54 am

Re: Sending Player info to a window

Message par marceros »

Hi,

I'm sorry. I think I missed your answer from about a year ago.

I'd like to rephrase my question. I think I understand better what I'm missing.

I'm using the mainWindow._window to set variables from one secondary window that will be used in another secondary window. This works.

The problem is that I set several variables with initial values in the init.js but I've just realized that I don't know how to get their values.

What would be the way to do that?

Marcelo
drakinite
Messages : 988
Inscription : mar. mai 12, 2020 10:06 am

Re: Sending Player info to a window

Message par drakinite »

I believe that init.js runs within the main window scope but inside of a code block. So the following code inside init.js:

Code : Tout sélectionner

var xVar = 1;
window.xWindow = 2;
const xConst = 3;
let xLet = 4;
results in xVar and xWindow being accessible from the window scope, but not xConst and xLet, because const and let are scoped differently from var.

The screenshot shows devtools open on the main window on the left, and on a dialog window on the right.
Image
Image
Data scientist, 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.
marceros
Messages : 36
Inscription : dim. avr. 21, 2013 1:54 am

Re: Sending Player info to a window

Message par marceros »

Thank you very much!

My problem was that I declared the variables with let or const instead of using var.

Your explanation solved my issue.
Répondre