What I'm trying to do is improve on a Cinnamon applet, out of curiosity and to keep myself busy. Maybe even learn something in the process.
Never learned JS so this may be extremely simple for somebody familiar with it.
So, the applet consists of a handful of JS scripts defined/included in the main
applet.js
. I can call functions residing in included scripts from the main script, but for the life of me couldn't find a way to call a function residing in the main script from one of the included scripts.Actually there is a place - a class? - where this is possible but only because the main script's
this
- no idea what exactly represents - is being passed as a parameter to that class(?). However other classes that I'd need to be calling main functions from do not take any parameters and it may become complicated if I were to modify them to such extent - and if I knew how.So far I only added a couple of my own functions in main
applet.js
, which have to be called from one of the included scripts; one functions works as it's called from the class that receives this
as parameter, but the other doesn't since the call resides in a class without parameters.My question would be: is it possible to make the main
this
available to the other class in the included script without changing class definitions? Hopefully without circular inclusions or other unwanted techniques?EDIT: Nevermind, just used the workaround of passing this as parameter to the class in the other file. It works.