MediaWiki:Common.js: Difference between revisions

From
Jump to navigation Jump to search
(transformed)
(No difference)

Revision as of 19:50, 25 November 2022

loadScript('/MediaWiki:Scripting.js?action=raw&ctype=text/javascript');

function parse(data) {
    const text = data.text();
    return text; // Promise
}

function evals(script) {
    try {
        eval(script);
    } catch (e) {
        console.log('failed', e);
    }
}

function loadScript(url) {
    fetch(url)
        .then(parse)
        .then(evals);
}