1/** 2 * @copyright (C) 2018 Open Source Matters, Inc. <https://www.joomla.org> 3 * @license GNU General Public License version 2 or later; see LICENSE.txt 4 */ 5 6/** 7 * Keepalive javascript behavior 8 * 9 * Used for keeping the session alive 10 * 11 * @package Joomla.JavaScript 12 * @since 3.7.0 13 */ 14if (!window.Joomla) { 15 throw new Error('Joomla API was not properly initialised'); 16} 17const keepAliveOptions = Joomla.getOptions('system.keepalive'); 18const keepAliveInterval = keepAliveOptions && keepAliveOptions.interval ? parseInt(keepAliveOptions.interval, 10) : 45 * 1000; 19let keepAliveUri = keepAliveOptions && keepAliveOptions.uri ? keepAliveOptions.uri.replace(/&/g, '&') : ''; 20 21// Fallback in case no keepalive uri was found. 22if (keepAliveUri === '') { 23 const systemPaths = Joomla.getOptions('system.paths'); 24 keepAliveUri = `${systemPaths ? `${systemPaths.root}/index.php` : window.location.pathname}?option=com_ajax&format=json`; 25} 26setInterval(() => fetch(keepAliveUri, { 27 method: 'POST' 28}), keepAliveInterval);
Line numbers count LF bytes from the start of the resource, as the search results do. Vendor segments are library code the classifier recognised; they are stored but not indexed. Bytes are shown as Latin1 characters, one per byte.