Proyectos de Subversion Moodle

Rev

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

Rev 1 Rev 1441
Línea 157... Línea 157...
157
        remainingAttemps--;
157
        remainingAttemps--;
158
    }
158
    }
159
    return H5P;
159
    return H5P;
160
};
160
};
Línea -... Línea 161...
-
 
161
 
-
 
162
/* eslint-disable promise/no-native */
-
 
163
/**
-
 
164
 * Load the core/pending module.
-
 
165
 * @returns {Promise<Pending>}
-
 
166
 */
-
 
167
const getPendingClass = () => new Promise((resolve) => {
-
 
168
    require(['core/pending'], (Pending) => {
-
 
169
        resolve(Pending);
-
 
170
    });
-
 
171
});
161
 
172
 
162
document.onreadystatechange = async() => {
173
document.onreadystatechange = async() => {
163
    // Wait for instances to be initialize.
174
    // Wait for instances to be initialize.
164
    if (document.readyState !== 'complete') {
175
    if (document.readyState !== 'complete') {
165
        return;
176
        return;
Línea 210... Línea 221...
210
 
221
 
211
    H5PEmbedCommunicator.on('resize', function() {
222
    H5PEmbedCommunicator.on('resize', function() {
212
        H5P.trigger(instance, 'resize');
223
        H5P.trigger(instance, 'resize');
Línea -... Línea 224...
-
 
224
    });
-
 
225
 
-
 
226
    const Pending = await getPendingClass();
213
    });
227
    var resizePending = new Pending('core_h5p/iframe:resize');
214
 
228
 
215
    H5P.on(instance, 'resize', function() {
229
    H5P.on(instance, 'resize', function() {
216
        if (H5P.isFullscreen) {
230
        if (H5P.isFullscreen) {
Línea 229... Línea 243...
229
                    }
243
                    }
230
                );
244
                );
231
            } else {
245
            } else {
232
                H5PEmbedCommunicator.send('hello');
246
                H5PEmbedCommunicator.send('hello');
233
            }
247
            }
-
 
248
            resizePending.resolve();
234
        }, 0);
249
        }, 150);
235
    });
250
    });
Línea 236... Línea 251...
236
 
251
 
237
    // Get emitted xAPI data.
252
    // Get emitted xAPI data.
238
    H5P.externalDispatcher.on('xAPI', function(event) {
253
    H5P.externalDispatcher.on('xAPI', function(event) {
Línea 292... Línea 307...
292
            };
307
            };
293
            H5PEmbedCommunicator.postState(moodlecomponent, contentId, H5P.getxAPIActor(), stateId, JSON.stringify(statedata));
308
            H5PEmbedCommunicator.postState(moodlecomponent, contentId, H5P.getxAPIActor(), stateId, JSON.stringify(statedata));
294
        }
309
        }
295
    });
310
    });
Línea 296... Línea -...
296
 
-
 
297
    // Trigger initial resize for instance.
311
 
298
    H5P.trigger(instance, 'resize');
312
    H5P.trigger(instance, 'resize');