In version 2.1.0 (the current develop branche) the module and nodeHelper API both feature the requiresVersion variable. This allows you to set the minimum version number of the MagicMirror framework that is necessary for your module to run correctly. This is important, because version 2.1.0 will contain some API changes that might prevent your module from running in older versions.
More information about this feature can be found here: https://github.com/MichMich/MagicMirror/tree/develop/modules#requiresversion
Example code:
Module.register("testModule", {
requiresVersion: "2.1.0",
start: function() {
// do something
}
});
Of course, this feature would be way more powerfull if it was available starting from version 2.0.0. Unfortunately I did not have the time yet to invent a time machine. Therefor you can use a workaround if you really must do some manual checking. Starting from version 2.1.0, the frontend javascript will have a global variable called version. This is a string that represents the current version of the MagicMirror. In the node helper, this string is available via global.version.
So, if absolutely necessary, you can use the following code in your module:
// main module
if (!version) {
// this is an old version, give the user a warning and don't perform any other new API calls.
}
// node helper
if (!gobal.version) {
// this is an old version, give the user a warning and don't perform any other new API calls.
}
Since this feature is still in the develop branch, it’s not final and might change. Suggestions are welcome.