Killed App Post Loader
This commit is contained in:
1 parent
73134a4f45
commit
c18e1a776d
6 files changed
+58
-73
No files matched your search
@@ -1,10 +1,8 @@
|
||||
/* Global Constatns */
|
||||
|
||||
let webApp
|
||||
let PROJECTS_SCHEMA
|
||||
let ENVIRONMENT
|
||||
|
||||
/* New Root object*/
|
||||
/* Root object*/
|
||||
let UI = {
|
||||
projects: {}
|
||||
projects: {},
|
||||
schemas: { projectSchema: undefined },
|
||||
environment: undefined,
|
||||
running: {}
|
||||
}
|
||||
@@ -26,8 +26,8 @@ function newWebApp() {
|
||||
Here we will setup the UI object, with all the
|
||||
projects and spaces.
|
||||
*/
|
||||
for (let i = 0; i < PROJECTS_SCHEMA.length; i++) {
|
||||
let projectDefinition = PROJECTS_SCHEMA[i]
|
||||
for (let i = 0; i < UI.schemas.projectSchema.length; i++) {
|
||||
let projectDefinition = UI.schemas.projectSchema[i]
|
||||
UI.projects[projectDefinition.propertyName] = {}
|
||||
let projectInstance = UI.projects[projectDefinition.propertyName]
|
||||
|
||||
|
||||
@@ -5,15 +5,12 @@ function newWebAppLoader() {
|
||||
loadModules: loadModules
|
||||
}
|
||||
|
||||
let postLoader
|
||||
return thisObject
|
||||
|
||||
async function loadModules() {
|
||||
try {
|
||||
let modulesArray = [
|
||||
'WebDebugLog.js',
|
||||
'WebAppPostLoader.js',
|
||||
'Globals.js',
|
||||
'WebApp.js'
|
||||
]
|
||||
|
||||
@@ -115,8 +112,8 @@ function newWebAppLoader() {
|
||||
|
||||
if (downloadedCounter === modulesArray.length) {
|
||||
setTimeout(() => {
|
||||
postLoader = newWebAppPostLoader()
|
||||
postLoader.start()
|
||||
UI.running.webApp = newWebApp()
|
||||
UI.running.webApp.initialize()
|
||||
}, 500)
|
||||
|
||||
}
|
||||
|
||||
@@ -1,37 +0,0 @@
|
||||
|
||||
|
||||
function newWebAppPostLoader() {
|
||||
|
||||
let thisObject = {
|
||||
start: start
|
||||
}
|
||||
return thisObject
|
||||
|
||||
function start() {
|
||||
try {
|
||||
|
||||
setupEnvironment()
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
ENVIRONMENT = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
PROJECTS_SCHEMA = JSON.parse(file)
|
||||
webApp = newWebApp()
|
||||
webApp.initialize()
|
||||
}
|
||||
}
|
||||
} catch (err) {
|
||||
console.log('[ERROR] err.stack = ' + err.stack)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2,28 +2,36 @@
|
||||
function loadSuperalgos() {
|
||||
|
||||
let browser = checkBrowserVersion()
|
||||
if ((browser.name !== "Chrome" && browser.name!=="Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
|
||||
if ((browser.name !== "Chrome" && browser.name !== "Safari") || (browser.name === "Chrome" && parseInt(browser.version) < 85) || (browser.name === "Safari" && parseInt(browser.version) < 13)) {
|
||||
alert("Superalgos is officially supported on Google Chrome 85 or Safari 13.1 and above. Your browser version has been detected as potentially beneath this. If you continue you may experience some functionaility issues.\n\nDetected Browser: " + browser.name + "\nVersion: " + browser.version)
|
||||
}
|
||||
|
||||
loadModules()
|
||||
loadGlobals()
|
||||
|
||||
function checkBrowserVersion () {
|
||||
function loadGlobals() {
|
||||
let path = "Globals.js"
|
||||
REQUIREJS([path], onRequired)
|
||||
|
||||
let ua=navigator.userAgent,tem,M=ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []
|
||||
if(/trident/i.test(M[1])){
|
||||
tem=/\brv[ :]+(\d+)/g.exec(ua) || []
|
||||
return {name:'IE',version:(tem[1]||'')}
|
||||
function onRequired(pModule) {
|
||||
setupEnvironment()
|
||||
}
|
||||
if(M[1]==='Chrome'){
|
||||
tem=ua.match(/\bOPR|Edge\/(\d+)/)
|
||||
if(tem!=null) {return {name:'Opera', version:tem[1]}}
|
||||
}
|
||||
|
||||
function setupEnvironment() {
|
||||
httpRequest(undefined, 'Environment', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.environment = JSON.parse(file)
|
||||
setupProjectsSchema()
|
||||
}
|
||||
M=M[2]? [M[1], M[2]]: [navigator.appName, navigator.appVersion, '-?']
|
||||
if((tem=ua.match(/version\/(\d+)/i))!=null) {M.splice(1,1,tem[1])}
|
||||
return {
|
||||
name: M[0],
|
||||
version: M[1]
|
||||
}
|
||||
|
||||
function setupProjectsSchema() {
|
||||
httpRequest(undefined, 'ProjectsSchema', onResponse)
|
||||
|
||||
function onResponse(err, file) {
|
||||
UI.schemas.projectSchema = JSON.parse(file)
|
||||
loadModules()
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,12 +52,12 @@ function httpRequest(pContentToSend, pPath, callBackFunction) {
|
||||
if (this.readyState === 4 && this.status === 200) {
|
||||
try {
|
||||
callBackFunction(undefined, xmlHttpRequest.responseText)
|
||||
} catch(err) {
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = '+ err.stack)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = '+ pContentToSend)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pPath = '+ pPath)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> xmlHttpRequest.responseText = '+ xmlHttpRequest.responseText)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> callBackFunction = '+ callBackFunction)
|
||||
} catch (err) {
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> err.stack = ' + err.stack)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pContentToSend = ' + pContentToSend)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> pPath = ' + pPath)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> xmlHttpRequest.responseText = ' + xmlHttpRequest.responseText)
|
||||
console.log('[ERROR] httpRequest -> httpRequest -> callBackFunction = ' + callBackFunction)
|
||||
|
||||
}
|
||||
return
|
||||
@@ -73,3 +81,22 @@ function httpRequest(pContentToSend, pPath, callBackFunction) {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
function checkBrowserVersion() {
|
||||
|
||||
let ua = navigator.userAgent, tem, M = ua.match(/(opera|chrome|safari|firefox|msie|trident(?=\/))\/?\s*(\d+)/i) || []
|
||||
if (/trident/i.test(M[1])) {
|
||||
tem = /\brv[ :]+(\d+)/g.exec(ua) || []
|
||||
return { name: 'IE', version: (tem[1] || '') }
|
||||
}
|
||||
if (M[1] === 'Chrome') {
|
||||
tem = ua.match(/\bOPR|Edge\/(\d+)/)
|
||||
if (tem != null) { return { name: 'Opera', version: tem[1] } }
|
||||
}
|
||||
M = M[2] ? [M[1], M[2]] : [navigator.appName, navigator.appVersion, '-?']
|
||||
if ((tem = ua.match(/version\/(\d+)/i)) != null) { M.splice(1, 1, tem[1]) }
|
||||
return {
|
||||
name: M[0],
|
||||
version: M[1]
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user