Proyectos de Subversion Moodle

Rev

Rev 1 | Mostrar el archivo completo | | | Autoría | Ultima modificación | Ver Log |

Rev 1 Rev 11
Línea 21... Línea 21...
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
21
 * @license    http://www.gnu.org/copyleft/gpl.html GNU GPL v3 or later
22
 */
22
 */
23
define(
23
define(
24
[
24
[
25
    'jquery',
25
    'jquery',
26
    'core/custom_interaction_events'
26
    'core/custom_interaction_events',
-
 
27
    'core/pending',
27
],
28
],
28
function(
29
function(
29
    $,
30
    $,
30
    CustomEvents
31
    CustomEvents,
-
 
32
    PendingPromise,
31
) {
33
) {
Línea 32... Línea 34...
32
 
34
 
33
    var SELECTORS = {
35
    var SELECTORS = {
34
        ROOT: '[data-region="lazy-load-list"]',
36
        ROOT: '[data-region="lazy-load-list"]',
Línea 246... Línea 248...
246
     * @param {Function} loadCallback The callback to load items.
248
     * @param {Function} loadCallback The callback to load items.
247
     * @param {Function} renderCallback The callback to render the results.
249
     * @param {Function} renderCallback The callback to render the results.
248
     * @return {Object} promise
250
     * @return {Object} promise
249
     */
251
     */
250
    var initialLoadAndRender = function(root, loadCallback, renderCallback) {
252
    var initialLoadAndRender = function(root, loadCallback, renderCallback) {
-
 
253
        const pendingPromise = new PendingPromise('initialLoadAndRender');
251
        getContentContainer(root).empty();
254
        getContentContainer(root).empty();
252
        showPlaceholder(root);
255
        showPlaceholder(root);
253
        hideContent(root);
256
        hideContent(root);
254
        return loadAndRender(root, loadCallback, renderCallback)
257
        return loadAndRender(root, loadCallback, renderCallback)
255
            .then(function(items) {
258
            .then(function(items) {
Línea 265... Línea 268...
265
            })
268
            })
266
            .catch(function() {
269
            .catch(function() {
267
                hidePlaceholder(root);
270
                hidePlaceholder(root);
268
                showContent(root);
271
                showContent(root);
269
                return;
272
                return;
-
 
273
            })
-
 
274
            .then(() => {
-
 
275
                pendingPromise.resolve();
-
 
276
                return;
270
            });
277
            });
271
    };
278
    };
Línea 272... Línea 279...
272
 
279
 
273
    /**
280
    /**