Update frontend.js
This commit is contained in:
parent
8f05b551c1
commit
62a36f98b9
1 changed files with 13 additions and 14 deletions
27
frontend.js
27
frontend.js
|
@ -9,9 +9,20 @@ class JSPlusPlus {
|
|||
let js = jsCode.toString();
|
||||
Function(js)()
|
||||
}
|
||||
readInternetText(url) {
|
||||
var request = new XMLHttpRequest(); // Create a new XMLHttpRequest object
|
||||
request.open('GET', url, false); // Open the request with synchronous mode
|
||||
request.send(null); // Send the request with no additional data
|
||||
|
||||
if (request.status === 200) { // Check if the request was successful
|
||||
return request.responseText; // Return the response text
|
||||
} else {
|
||||
return 'Error: ' + request.status; // Return an error message if the request failed
|
||||
}
|
||||
}
|
||||
require(jsURI) {
|
||||
try {
|
||||
let req = JSPlusPlus.Frontend.readInternetText(jsURI);
|
||||
let req = JSPlusPlus.JSPlusPlus.readInternetText(jsURI);
|
||||
JSPlusPlus.General.exec(req);
|
||||
} catch {
|
||||
console.log(`Error! (Using Node.JS?)
|
||||
|
@ -21,7 +32,7 @@ class JSPlusPlus {
|
|||
}
|
||||
}
|
||||
}
|
||||
Frontend = class {
|
||||
HTMLFrontend = class {
|
||||
// Get element by ID
|
||||
getElementById(elementID) {
|
||||
return document.getElementById(elementID)
|
||||
|
@ -389,18 +400,6 @@ class JSPlusPlus {
|
|||
requestAnimationFrame(animate);
|
||||
}
|
||||
|
||||
readInternetText(url) {
|
||||
var request = new XMLHttpRequest(); // Create a new XMLHttpRequest object
|
||||
request.open('GET', url, false); // Open the request with synchronous mode
|
||||
request.send(null); // Send the request with no additional data
|
||||
|
||||
if (request.status === 200) { // Check if the request was successful
|
||||
return request.responseText; // Return the response text
|
||||
} else {
|
||||
return 'Error: ' + request.status; // Return an error message if the request failed
|
||||
}
|
||||
}
|
||||
|
||||
// Example: getFileSize(path/to/file)
|
||||
getFileSize(file) {
|
||||
file = file.toString();
|
||||
|
|
Loading…
Reference in a new issue