FatFractal customer forums

NoServer => NoServer Questions and Answers => Topic started by: julio.bradford on January 05, 2014, 11:26:39 PM

Title: concept of global variable
Post by: julio.bradford on January 05, 2014, 11:26:39 PM
   Is there a concept of a global value set within the ffdl file with FF-Javascript-Server-Side
   and then user with an Extension or EventHandlers?


Regards,

- Julio
Title: Re: concept of global variable
Post by: kevin@fatfractal.com on January 05, 2014, 11:37:51 PM
There is - here is an example:

In your FFDL -

SET_PRIVATE FFConsole.MuteEmail true

And to use in your code…

var mute_email = getFfdlSettingOrDefaultValue("FFConsole.MuteEmail", "false") === "true";
Title: Re: concept of global variable
Post by: gkc on January 06, 2014, 11:08:24 AM
FYI getFffdlSetting is part of the standard server-side SDK. getFfdlSettingOrDefaultValue is not, but here's the code

Code: [Select]
/**
 * @param {String} paramName The name of the SETting
 * @param {String} defaultValue A default value if a parameter of this name was not SET
 * @return {String}
 */
function getFfdlSettingOrDefaultValue(paramName, defaultValue) {
    var setting = ff.getFfdlSetting(paramName);
    if (setting === null) {
        print ('WARN : getFfdlSettingOrDefaultValue() : Failed to get FFDL setting ' + paramName + ' - defaulting to ' + defaultValue);
        return defaultValue;
    }
    else {
        print ('INFO : getFfdlSettingOrDefaultValue() : ' + paramName + ' - found setting ' + setting);
        return setting;
    }
}
Title: Re: concept of global variable
Post by: kwylez on January 08, 2014, 09:00:01 PM
I'm always finding out little (amazing) nuggets about the platform that I didn't know