mirror of
https://github.com/moodle/moodle.git
synced 2025-01-18 22:08:20 +01:00
10 lines
1.3 KiB
JavaScript
10 lines
1.3 KiB
JavaScript
/**
|
|
* Contain the logic for the loading icon.
|
|
*
|
|
* @module core/loadingicon
|
|
* @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>
|
|
* @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
|
|
*/
|
|
define("core/loadingicon",["jquery","core/templates"],(function($,Templates){var TEMPLATES_LOADING="core/loading",getIcon=function(){return Templates.render(TEMPLATES_LOADING,{})},addIconToContainerRemoveOnCompletion=function(container,loadingIconPromise){return getIcon().then((function(html){var loadingIcon=$(html).hide();return $(container).append(loadingIcon),loadingIcon.fadeIn(150),$.when(loadingIcon.promise(),loadingIconPromise)})).then((function(loadingIcon){return loadingIcon.fadeOut(100).promise()})).then((function(loadingIcon){loadingIcon.remove()}))};return{getIcon:getIcon,addIconToContainer:function(container){return getIcon().then((function(html){var loadingIcon=$(html).hide();return $(container).append(loadingIcon),loadingIcon.fadeIn(150),loadingIcon}))},addIconToContainerWithPromise:function(container){var loadingIconPromise=$.Deferred();return addIconToContainerRemoveOnCompletion(container,loadingIconPromise),loadingIconPromise},addIconToContainerRemoveOnCompletion:addIconToContainerRemoveOnCompletion}}));
|
|
|
|
//# sourceMappingURL=loadingicon.min.js.map
|