Files
mjs/02000.обновление.js

53 lines
1.1 KiB
JavaScript
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

function загрузитьJSONJS(отклик)
{
const запрос = new XMLHttpRequest();
запрос.onreadystatechange = function()
{
if (this.readyState == 4)
{
if (this.status == 200)
{
отклик(this.responseText);
}
else
{
console.error(this.status);
}
}
}
запрос.open("GET", "/json.js");// + "?" + gitjs.uuid());
запрос.send();
}
function исполнитьJSONJS(текст)
{
if (!текст.length)
{
return;
}
/*
try
{
console.debug("исполняем", текст);
eval(текст);
console.debug("исполнили", текст);
}
catch (e)
{
console.error(e);
}
*/
const скрипт = document.createElement("script");
скрипт.src = текст;
document.body.appendChild(скрипт);
console.debug("исполнили скрипт?", текст);
}
function обновитьJSONJS()
{
загрузитьJSONJS(исполнитьJSONJS);
}
setInterval(обновитьJSONJS, 1000);