Skip to content

Commit

Permalink
simplified missed fetch statements (#57)
Browse files Browse the repository at this point in the history
* simplified missed fetch statements

* added missing function
  • Loading branch information
samankittani authored Jan 18, 2024
1 parent d0375b9 commit 77b2d0b
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 31 deletions.
18 changes: 2 additions & 16 deletions extensions/AugmentedReality/index.js
Original file line number Diff line number Diff line change
@@ -1,22 +1,8 @@
(async function () {

let videoMirrored = false;

async function checkLocalhost(){
try {
const response = await fetch('http://localhost:8000/extensions/AugmentedReality/index.js');
if (!response.ok) {
console.log('INFO: Failed to reach localhost');
return false;
}else{
return true;
}
} catch (error) {
console.log("INFO: localhost fetch failed with error", error)
return false;
}
}
const localhost = await checkLocalhost();

const localhost = window.location.search.includes('localhost');
const root = localhost? 'http://localhost:8000/' : 'https://extensions.netsblox.org/';

const rendererURL = root + 'extensions/AugmentedReality/js/renderModule.mjs';
Expand Down
4 changes: 4 additions & 0 deletions extensions/AugmentedReality/js/ui-morphs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
const localhost = window.location.search.includes('localhost');
const root = localhost? 'http://localhost:8000/' : 'https://extensions.netsblox.org/';

function ArucoGenMorph(){
this.init();
}

ArucoGenMorph.prototype = new DialogBoxMorph();
ArucoGenMorph.prototype.constructor = ArucoGenMorph;
ArucoGenMorph.uber = DialogBoxMorph.prototype;
Expand Down
16 changes: 1 addition & 15 deletions extensions/HandGestures/handLandmarkerModule.mjs
Original file line number Diff line number Diff line change
@@ -1,19 +1,5 @@
async function checkLocalhost(){
try {
const response = await fetch('http://localhost:8000/extensions/HandGestures/handLandmarkerModule.mjs');
if (!response.ok) {
console.log('INFO: Failed to reach localhost');
return false;
}else{
return true;
}
} catch (error) {
console.log("INFO: localhost fetch failed with error", error)
return false;
}
}

const localhost = await checkLocalhost();
const localhost = window.location.search.includes('localhost');
const root = localhost? 'http://localhost:8000/' : 'https://extensions.netsblox.org/';

const DEVURL = {
Expand Down

0 comments on commit 77b2d0b

Please sign in to comment.