@ou-imdt/utils
Version:
Utility library for interactive media development
25 lines (24 loc) • 984 B
JavaScript
/**
* Loads all data from the VLE server.
* @param {Object} options - Options for loading all data.
* @param {boolean | string} options.user - User/global, or group identifier.
* @param {string} [options.activityId] - Optional activity ID.
* @param {string} [options.documentId] - Optional document ID.
* @param {string} [options.courseId] - Optional course ID.
* @param {string} [options.modName] - Either 'oucontent' or 'htmlactivity'
* @returns {Promise<any>} A promise that resolves with all loaded data, or rejects on error.
*/
export default function loadAllVLEData(options) {
const {
user,
activityId = undefined,
documentId = undefined,
courseId = undefined,
modName = undefined
} = options;
return new Promise((resolve, reject) => {
const onSuccess = (fields) => resolve(fields);
const onError = (fields) => reject(fields);
VLE.get_all_server_data(user, onSuccess, onError, activityId, documentId, courseId, modName);
});
}