Proyectos de Subversion Moodle

Rev

Autoría | Ultima modificación | Ver Log |

define("core/stored_progress",["exports","core/ajax","core/notification"],(function(_exports,Ajax,_notification){var obj;function _getRequireWildcardCache(nodeInterop){if("function"!=typeof WeakMap)return null;var cacheBabelInterop=new WeakMap,cacheNodeInterop=new WeakMap;return(_getRequireWildcardCache=function(nodeInterop){return nodeInterop?cacheNodeInterop:cacheBabelInterop})(nodeInterop)}Object.defineProperty(_exports,"__esModule",{value:!0}),_exports.init=void 0,Ajax=function(obj,nodeInterop){if(!nodeInterop&&obj&&obj.__esModule)return obj;if(null===obj||"object"!=typeof obj&&"function"!=typeof obj)return{default:obj};var cache=_getRequireWildcardCache(nodeInterop);if(cache&&cache.has(obj))return cache.get(obj);var newObj={},hasPropertyDescriptor=Object.defineProperty&&Object.getOwnPropertyDescriptor;for(var key in obj)if("default"!==key&&Object.prototype.hasOwnProperty.call(obj,key)){var desc=hasPropertyDescriptor?Object.getOwnPropertyDescriptor(obj,key):null;desc&&(desc.get||desc.set)?Object.defineProperty(newObj,key,desc):newObj[key]=obj[key]}newObj.default=obj,cache&&cache.set(obj,newObj);return newObj}
/**
   * Script to update stored_progress progress bars on the screen.
   *
   * @module     core/stored_progress
   * @copyright  2023 onwards Catalyst IT {@link http://www.catalyst-eu.net/}
   * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
   * @author     Conn Warwicker <conn.warwicker@catalyst-eu.net>
   */(Ajax),_notification=(obj=_notification)&&obj.__esModule?obj:{default:obj};var STORED_PROGRESS_LOADED=!1;function poll(ids,timeout){let promise=Ajax.call([{methodname:"core_output_poll_stored_progress",args:{ids:ids}}]),repollids=[];promise[0].then((function(results){return results.forEach((function(data){updateProgressBar(data.uniqueid,data.progress,data.message,data.estimated,data.error),data.progress<100&&!data.error&&repollids.push(data.id),data.timeout&&data.timeout>0&&(timeout=data.timeout)})),repollids.length>0&&setTimeout((()=>poll(repollids,timeout)),1e3*timeout)})).catch(_notification.default.exception)}_exports.init=timeout=>{if(!1===STORED_PROGRESS_LOADED){let ids=[];document.querySelectorAll(".stored-progress-bar").forEach((el=>{let id=el.dataset.recordid;ids.push(id)})),poll(ids,timeout),STORED_PROGRESS_LOADED=!0}}}));

//# sourceMappingURL=stored_progress.min.js.map