CoreFiles by mySites.guru
run-schedule.js37 lines, 1,096 bytes, from Joomla_4.3.4-Stable-Full_Package.zip
Raw History Compare with 4.3.3
md5
30cff6f2ad2073d1a975a2fd14df55a8
sha1
874b13e6a6457aff479199bd1f4991a8e6af3617
sha256
ccc2c1dd21345c0c6b3b6c1660b1944b8b4b2b5b17a4ed3ca72220869d68a01b
/**
 * @copyright   (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
 * @license     GNU General Public License version 2 or later; see LICENSE.txt
 */

/**
 * Makes calls to com_ajax to trigger the Scheduler.
 *
 * Used for lazy scheduling of tasks.
 *
 * @package  Joomla.Plugins
 * @subpackage System.ScheduleRunner
 *
 * @since    4.1.0
 */
if (!window.Joomla) {
  throw new Error('Joomla API was not properly initialised');
}
const initScheduler = () => {
  const options = Joomla.getOptions('plg_system_schedulerunner');
  const paths = Joomla.getOptions('system.paths');
  const interval = (options && options.interval ? parseInt(options.interval, 10) : 300) * 1000;
  const uri = `${paths ? `${paths.root}/index.php` : window.location.pathname}?option=com_ajax&format=raw&plugin=RunSchedulerLazy&group=system`;
  setInterval(() => fetch(uri, {
    method: 'GET'
  }), interval);

  // Run it at the beginning at least once
  fetch(uri, {
    method: 'GET'
  });
};
(document => {
  document.addEventListener('DOMContentLoaded', () => {
    initScheduler();
  });
})(document);

The same content is in 81 releases, Joomla 4.3.2-rc1 to 5.1.4. See them all, or every version of this file.