This repository has been archived on 2023-04-02. You can view files and clone it, but cannot push or open issues or pull requests.
Stairway-js/res/js/io.js

40 lines
1.3 KiB
JavaScript

// @license magnet:?xt=urn:btih:1f739d935676111cfff4b4693e3816e664797050&dn=gpl-3.0.txt GPL-3.0-or-later
/*
* Stairway.js: a simple JavaScript privacy quiz
* Copyright © 2021 luca0N!
*
* This file is part of Stairway.js.
*
* Stairway.js is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* Stairway.js is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with Stairway.js. If not, see <https://www.gnu.org/licenses/>.
*
* E-mail contact: <luca0n@luca0n.com>.
*/
/**
* Attempts to fetch the resource file and returns it via callback.
* @param file The desired file.
* @param callback A function(string) which will be used to return the result of the requested file.
* @since 2021-05-27
*/
function sendGetRequest(file, listener){
let request = new XMLHttpRequest();
request.addEventListener('load', function(){
listener(this.responseText);
});
request.open("GET", file);
request.send();
}
// @license-end