Current Path : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/ |
Current File : C:/Users/Mahmood/Desktop/moodle/lib/amd/build/loadingicon.min.js.map |
{"version":3,"sources":["../src/loadingicon.js"],"names":["define","$","Templates","TEMPLATES","LOADING","getIcon","render","addIconToContainerRemoveOnCompletion","container","loadingIconPromise","then","html","loadingIcon","hide","append","fadeIn","when","promise","fadeOut","remove","addIconToContainer","addIconToContainerWithPromise","Deferred"],"mappings":"AAwBAA,OAAM,oBAAC,CAAC,QAAD,CAAW,gBAAX,CAAD,CAA+B,SAASC,CAAT,CAAYC,CAAZ,CAAuB,IACpDC,CAAAA,CAAS,CAAG,CACZC,OAAO,CAAE,cADG,CADwC,CAKpDC,CAAO,CAAG,UAAW,CACrB,MAAOH,CAAAA,CAAS,CAACI,MAAV,CAAiBH,CAAS,CAACC,OAA3B,CAAoC,EAApC,CACV,CAPuD,CAuCpDG,CAAoC,CAAG,SAASC,CAAT,CAAoBC,CAApB,CAAwC,CAC/E,MAAOJ,CAAAA,CAAO,GACbK,IADM,CACD,SAASC,CAAT,CAAe,CACjB,GAAIC,CAAAA,CAAW,CAAGX,CAAC,CAACU,CAAD,CAAD,CAAQE,IAAR,EAAlB,CACAZ,CAAC,CAACO,CAAD,CAAD,CAAaM,MAAb,CAAoBF,CAApB,EACAA,CAAW,CAACG,MAAZ,CAAmB,GAAnB,EAEA,MAAOd,CAAAA,CAAC,CAACe,IAAF,CAAOJ,CAAW,CAACK,OAAZ,EAAP,CAA8BR,CAA9B,CACV,CAPM,EAQNC,IARM,CAQD,SAASE,CAAT,CAAsB,CAIxB,MAAOA,CAAAA,CAAW,CAACM,OAAZ,CAAoB,GAApB,EAAyBD,OAAzB,EACV,CAbM,EAcNP,IAdM,CAcD,SAASE,CAAT,CAAsB,CACxBA,CAAW,CAACO,MAAZ,EAGH,CAlBM,CAmBV,CA3DuD,CA8ExD,MAAO,CACHd,OAAO,CAAEA,CADN,CAEHe,kBAAkB,CA9DG,QAArBA,CAAAA,kBAAqB,CAASZ,CAAT,CAAoB,CACzC,MAAOH,CAAAA,CAAO,GACbK,IADM,CACD,SAASC,CAAT,CAAe,CACjB,GAAIC,CAAAA,CAAW,CAAGX,CAAC,CAACU,CAAD,CAAD,CAAQE,IAAR,EAAlB,CACAZ,CAAC,CAACO,CAAD,CAAD,CAAaM,MAAb,CAAoBF,CAApB,EACAA,CAAW,CAACG,MAAZ,CAAmB,GAAnB,EAEA,MAAOH,CAAAA,CACV,CAPM,CAQV,CAmDM,CAGHS,6BAA6B,CAXG,QAAhCA,CAAAA,6BAAgC,CAASb,CAAT,CAAoB,CACpD,GAAIC,CAAAA,CAAkB,CAAGR,CAAC,CAACqB,QAAF,EAAzB,CAEAf,CAAoC,CAACC,CAAD,CAAYC,CAAZ,CAApC,CAEA,MAAOA,CAAAA,CACV,CAEM,CAIHF,oCAAoC,CAAEA,CAJnC,CAOV,CArFK,CAAN","sourcesContent":["// This file is part of Moodle - http://moodle.org/\n//\n// Moodle is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// Moodle is distributed in the hope that it will be useful,\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with Moodle. If not, see <http://www.gnu.org/licenses/>.\n\n/**\n * Contain the logic for the loading icon.\n *\n * @module core/loading_icon\n * @class loading_icon\n * @package core\n * @copyright 2019 Andrew Nicols <andrew@nicols.co.uk>\n * @license http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later\n */\ndefine(['jquery', 'core/templates'], function($, Templates) {\n var TEMPLATES = {\n LOADING: 'core/loading',\n };\n\n var getIcon = function() {\n return Templates.render(TEMPLATES.LOADING, {});\n };\n\n /**\n * Add a loading icon to the end of the specified container and return an unresolved promise.\n *\n * Resolution of the returned promise causes the icon to be faded out and removed.\n *\n * @method addIconToContainer\n * @param {jQuery} container The element to add the spinner to\n * @return {Promise} The Promise used to create the icon.\n */\n var addIconToContainer = function(container) {\n return getIcon()\n .then(function(html) {\n var loadingIcon = $(html).hide();\n $(container).append(loadingIcon);\n loadingIcon.fadeIn(150);\n\n return loadingIcon;\n });\n };\n\n /**\n * Add a loading icon to the end of the specified container and return an unresolved promise.\n *\n * Resolution of the returned promise causes the icon to be faded out and removed.\n *\n * @method addIconToContainerWithPromise\n * @param {jQuery} container The element to add the spinner to\n * @param {Promise} loadingIconPromise The jQuery Promise which determines the removal of the icon\n * @return {jQuery} The Promise used to create and then remove the icon.\n */\n var addIconToContainerRemoveOnCompletion = function(container, loadingIconPromise) {\n return getIcon()\n .then(function(html) {\n var loadingIcon = $(html).hide();\n $(container).append(loadingIcon);\n loadingIcon.fadeIn(150);\n\n return $.when(loadingIcon.promise(), loadingIconPromise);\n })\n .then(function(loadingIcon) {\n // Once the content has finished loading and\n // the loading icon has been shown then we can\n // fade the icon away to reveal the content.\n return loadingIcon.fadeOut(100).promise();\n })\n .then(function(loadingIcon) {\n loadingIcon.remove();\n\n return;\n });\n };\n\n /**\n * Add a loading icon to the end of the specified container and return an unresolved promise.\n *\n * Resolution of the returned promise causes the icon to be faded out and removed.\n *\n * @method addIconToContainerWithPromise\n * @param {jQuery} container The element to add the spinner to\n * @return {Promise} A jQuery Promise to resolve when ready\n */\n var addIconToContainerWithPromise = function(container) {\n var loadingIconPromise = $.Deferred();\n\n addIconToContainerRemoveOnCompletion(container, loadingIconPromise);\n\n return loadingIconPromise;\n };\n\n return {\n getIcon: getIcon,\n addIconToContainer: addIconToContainer,\n addIconToContainerWithPromise: addIconToContainerWithPromise,\n addIconToContainerRemoveOnCompletion: addIconToContainerRemoveOnCompletion,\n };\n\n});\n"],"file":"loadingicon.min.js"}