Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Moodle user page load PerformanceNavigationTiming
define(['jquery', 'core/config', 'core/notification'],
function($, config, notification) {
// https://developer.mozilla.org/en-US/docs/Web/API/PerformanceNavigationTiming
var preftiming = performance.timing;
var params = {
contextid: config.contextid,
preftiming: JSON.stringify(preftiming),
sesskey: config.sesskey
};
$(window).on('load', function () {
$.post(config.wwwroot + '/log_user_page_pref.php', params)
.done(function(data, status) {
try {
console.log(data + status);
} catch (err) {
//notification.exception(err);
}
})
.fail(function (jqXHR, status, error) {
//notification.exception(error);
});
});
}
);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment