1 line
1.3 KiB
Plaintext
1 line
1.3 KiB
Plaintext
![]() |
{"version":3,"file":"settings.min.js","sources":["../../src/util/settings.js"],"sourcesContent":["/*eslint no-var: \"error\" */\n/*eslint-env es6*/\n\nimport {call} from 'core/ajax';\nimport notification from 'core/notification';\n\n// Prepare default value.\nlet settingcache = null;\n\n/**\n * Check if premium status is enabled.\n * @param {String} key\n * @returns {}\n */\nexport function settings ( key ){\n const settings = loadsettings();\n if ( key in settings ) {\n return settings[key];\n } else {\n return null;\n }\n}\n\n/**\n * Get settings from server or cache\n * @returns {Object} The settings object\n */\nfunction loadsettings() {\n if (!settingcache) {\n // Retrieve setting cache if needed.\n call([{\n methodname: 'local_treestudyplan_getsettings',\n args: {}\n }])[0].then(function(response){\n settingcache = response;\n }).catch(notification.exception);\n }\n return settingcache;\n}\n\n// Preload premium status.\nloadsettings();"],"names":["key","settings","loadsettings","settingcache","methodname","args","then","response","catch","notification","exception"],"mappings":"0NAc2BA,WACjBC,SAAWC,sBACZF,OAAOC,SACDA,SAASD,KAET,8EAZXG,aAAe,cAoBVD,sBACAC,6BAEI,CAAC,CACFC,WAAY,kCACZC,KAAM,MACN,GAAGC,MAAK,SAASC,UACjBJ,aAAeI,YAChBC,MAAMC,sBAAaC,WAEnBP,aAIXD"}
|