If you are talking about your own custom JavaScript files that you created, then you have to figure out how to set the variables yourself. For example, you can use PHP to check if the class exists and then add statements like this when writing the HTML of the page:
Code: Select allif (class_exists("myNamePlugin")) {
print "<script> var classXLoaded = 'yes';</script>";
}
else {
print "<script> var classXLoaded = 'no';</script>";
}
Or you could create a hidden field in the HTML page:
Code: Select allif (class_exists("myNamePlugin"))
$val = 'yes';
else
$val = 'no';
print "<input id=\"classXLoaded\" name=\"classXLoaded\" type=\"hidden\" value=\"$val\">";
I don't know why you are having to check this. If your JavaScript file is in a plugin, then the plugin's class file was loaded if you are executing its JavaScript file.
Your plugin's class is always loaded as long as you enabled the plugin under
Admin > Plugins > Plugin Manager.
If you have other classes inside your plugin, then add
require statements in the plugin's setup() function to make sure that they are loaded as well.