primo commit
This commit is contained in:
21
media/plg_system_schedulerunner/joomla.asset.json
Normal file
21
media/plg_system_schedulerunner/joomla.asset.json
Normal file
@ -0,0 +1,21 @@
|
||||
{
|
||||
"$schema": "https://developer.joomla.org/schemas/json-schema/web_assets.json",
|
||||
"name": "plg_system_schedulerunner",
|
||||
"version": "4.0.0",
|
||||
"description": "Joomla CMS",
|
||||
"license": "GPL-2.0-or-later",
|
||||
"assets": [
|
||||
{
|
||||
"name": "plg_system_schedulerunner.run-schedule",
|
||||
"type": "script",
|
||||
"uri": "plg_system_schedulerunner/run-schedule.min.js",
|
||||
"dependencies": [
|
||||
"core"
|
||||
],
|
||||
"attributes": {
|
||||
"type": "module"
|
||||
},
|
||||
"version": "229d3b"
|
||||
}
|
||||
]
|
||||
}
|
||||
35
media/plg_system_schedulerunner/js/run-schedule.js
Normal file
35
media/plg_system_schedulerunner/js/run-schedule.js
Normal file
@ -0,0 +1,35 @@
|
||||
/**
|
||||
* @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);
|
||||
4
media/plg_system_schedulerunner/js/run-schedule.min.js
vendored
Normal file
4
media/plg_system_schedulerunner/js/run-schedule.min.js
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
/**
|
||||
* @copyright (C) 2021 Open Source Matters, Inc. <https://www.joomla.org>
|
||||
* @license GNU General Public License version 2 or later; see LICENSE.txt
|
||||
*/if(!window.Joomla)throw new Error("Joomla API was not properly initialised");const initScheduler=()=>{const t=Joomla.getOptions("plg_system_schedulerunner"),o=Joomla.getOptions("system.paths"),n=(t&&t.interval?parseInt(t.interval,10):300)*1e3,e=`${o?`${o.root}/index.php`:window.location.pathname}?option=com_ajax&format=raw&plugin=RunSchedulerLazy&group=system`;setInterval(()=>fetch(e,{method:"GET"}),n),fetch(e,{method:"GET"})};(t=>{t.addEventListener("DOMContentLoaded",initScheduler)})(document);
|
||||
BIN
media/plg_system_schedulerunner/js/run-schedule.min.js.gz
Normal file
BIN
media/plg_system_schedulerunner/js/run-schedule.min.js.gz
Normal file
Binary file not shown.
Reference in New Issue
Block a user