CoreFiles by mySites.guru
keepalive.js47 lines, 1,292 bytes, from Joomla_4.0.0-alpha2-Alpha-Full_Package.zip
Raw History Compare with 3.10.0-alpha9
md5
f89efae935dc6d3a97d323a1038a5b4b
sha1
a4362b6acc898bbf88067e0e566ff5e34db1aaa7
sha256
8159f1ee5e316a35842a6132ccdc9d7673e1ebc6ecfd3e1be1353784269b1d5d
/**
 * @copyright   Copyright (C) 2005 - 2017 Open Source Matters, Inc. All rights reserved.
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Keepalive javascript behavior
 *
 * Used for keeping the session alive
 *
 * @package  Joomla
 * @since    3.7.0
 */
!(function(){
	'use strict';

	document.addEventListener('DOMContentLoaded', function() {

		var keepaliveOptions  = Joomla.getOptions('system.keepalive'),
            keepaliveUri      = keepaliveOptions && keepaliveOptions.uri ? keepaliveOptions.uri.replace(/&/g, '&') : '',
            keepaliveInterval = keepaliveOptions && keepaliveOptions.interval ? keepaliveOptions.interval : 45 * 1000;

        // Fallback in case no keepalive uri was found.
        if (keepaliveUri === '')
        {
            var systemPaths = Joomla.getOptions('system.paths');

            keepaliveUri = (systemPaths ? systemPaths.root + '/index.php' : window.location.pathname) + '?option=com_ajax&format=json';
        }

		window.setInterval(function() {
			Joomla.request({
				url:    keepaliveUri,
				onSuccess: function(response, xhr)
				{
					// Do nothing
				},
				onError: function(xhr)
				{
					// Do nothing
				}
			});
		}, keepaliveInterval);

	});

})(window, document, Joomla);

No other release has this exact content. See every version of this file.