mirror of
				https://github.com/zulip/zulip.git
				synced 2025-11-04 05:53:43 +00:00 
			
		
		
		
	This commit prepares the frontend code to be consumed by webpack. It is a hack: In theory, modules should be declaring and importing the modules they depend on and the globals they expose directly. However, that requires significant per-module work, which we don't really want to block moving our toolchain to webpack on. So we expose the modules by setting window.varName = varName; as needed in the js files.
		
			
				
	
	
		
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			48 lines
		
	
	
		
			1.3 KiB
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
var settings_sections = (function () {
 | 
						|
 | 
						|
var exports = {};
 | 
						|
 | 
						|
var load_func_dict = new Dict(); // section -> function
 | 
						|
var is_loaded = new Dict(); // section -> bool
 | 
						|
 | 
						|
exports.initialize = function () {
 | 
						|
    load_func_dict.set('your-account', settings_account.set_up);
 | 
						|
    load_func_dict.set('display-settings', settings_display.set_up);
 | 
						|
    load_func_dict.set('notifications', settings_notifications.set_up);
 | 
						|
    load_func_dict.set('your-bots', settings_bots.set_up);
 | 
						|
    load_func_dict.set('alert-words', alert_words_ui.set_up_alert_words);
 | 
						|
    load_func_dict.set('uploaded-files', attachments_ui.set_up_attachments);
 | 
						|
    load_func_dict.set('muted-topics', settings_muting.set_up);
 | 
						|
};
 | 
						|
 | 
						|
exports.load_settings_section = function (section) {
 | 
						|
    if (!load_func_dict.has(section)) {
 | 
						|
        blueslip.error('Unknown section ' + section);
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    if (is_loaded.get(section)) {
 | 
						|
        // We only load sections once (unless somebody calls
 | 
						|
        // reset_sections).
 | 
						|
        return;
 | 
						|
    }
 | 
						|
 | 
						|
    var load_func = load_func_dict.get(section);
 | 
						|
 | 
						|
    // Do the real work here!
 | 
						|
    load_func();
 | 
						|
    is_loaded.set(section, true);
 | 
						|
};
 | 
						|
 | 
						|
exports.reset_sections = function () {
 | 
						|
    is_loaded.clear();
 | 
						|
};
 | 
						|
 | 
						|
return exports;
 | 
						|
}());
 | 
						|
 | 
						|
if (typeof module !== 'undefined') {
 | 
						|
    module.exports = settings_sections;
 | 
						|
}
 | 
						|
window.settings_sections = settings_sections;
 |