[ Index ]

PHP Cross Reference of Joomla 4.2.2 documentation

title

Body

[close]

/media/system/js/ -> keepalive-es5.js (source)

   1  (function () {
   2    'use strict';
   3  
   4    /**
   5     * @copyright   (C) 2018 Open Source Matters, Inc. <https://www.joomla.org>
   6     * @license     GNU General Public License version 2 or later; see LICENSE.txt
   7     */
   8  
   9    /**
  10     * Keepalive javascript behavior
  11     *
  12     * Used for keeping the session alive
  13     *
  14     * @package  Joomla.JavaScript
  15     * @since    3.7.0
  16     */
  17    if (!window.Joomla) {
  18      throw new Error('Joomla API was not properly initialised');
  19    }
  20  
  21    var keepAliveOptions = Joomla.getOptions('system.keepalive');
  22    var keepAliveInterval = keepAliveOptions && keepAliveOptions.interval ? parseInt(keepAliveOptions.interval, 10) : 45 * 1000;
  23    var keepAliveUri = keepAliveOptions && keepAliveOptions.uri ? keepAliveOptions.uri.replace(/&amp;/g, '&') : ''; // Fallback in case no keepalive uri was found.
  24  
  25    if (keepAliveUri === '') {
  26      var systemPaths = Joomla.getOptions('system.paths');
  27      keepAliveUri = (systemPaths ? systemPaths.root + "/index.php" : window.location.pathname) + "?option=com_ajax&format=json";
  28    }
  29  
  30    setInterval(function () {
  31      return navigator.sendBeacon(keepAliveUri);
  32    }, keepAliveInterval);
  33  
  34  })();


Generated: Wed Sep 7 05:41:13 2022 Chilli.vc Blog - For Webmaster,Blog-Writer,System Admin and Domainer