FatFractal customer forums



Author Topic: concept of global variable  (Read 1999 times)

julio.bradford

  • Newbie
  • *
  • Posts: 5
    • View Profile
concept of global variable
« 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

kevin@fatfractal.com

  • Administrator
  • *****
  • Posts: 56
    • View Profile
Re: concept of global variable
« Reply #1 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";
« Last Edit: January 06, 2014, 11:08:51 AM by gkc »

gkc

  • Administrator
  • *****
  • Posts: 375
    • View Profile
Re: concept of global variable
« Reply #2 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;
    }
}

kwylez

  • Newbie
  • *
  • Posts: 27
    • View Profile
Re: concept of global variable
« Reply #3 on: January 08, 2014, 09:00:01 PM »
I'm always finding out little (amazing) nuggets about the platform that I didn't know

 

Copyright © FatFractal customer forums