CoreFiles by mySites.guru
keepalive.js47 lines, 1,292 bytes, from Joomla_4.0.0-alpha3-Alpha-Full_Package.zip
Raw History Compare with 4.0.0-alpha2
md5
00c7be4b0bd77c5c7e0847d22321e22d
sha1
63f6d092814ad4c67e265bd735deb3458e9d7055
sha256
0e3924cc6df433150b87ae6d92e686ea93c638ac3290568c113289304ad90820
/**
 * @copyright   Copyright (C) 2005 - 2018 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.