From 400bc04405ffad8d3ab7e68ff6d14a5bfd9ad03f Mon Sep 17 00:00:00 2001 From: Dennis Eichhorn Date: Tue, 2 Apr 2019 22:44:46 +0200 Subject: [PATCH] Use js modules --- tests/app/forms_input.php | 6 +- tests/app/index.php | 112 +----------------- tests/app/notifications.php | 19 +-- tests/app/tables.php | 9 +- tests/load.js | 222 +++++++++++++++++++----------------- 5 files changed, 140 insertions(+), 228 deletions(-) diff --git a/tests/app/forms_input.php b/tests/app/forms_input.php index c3d3526..e64bbca 100644 --- a/tests/app/forms_input.php +++ b/tests/app/forms_input.php @@ -184,8 +184,10 @@ - \ No newline at end of file diff --git a/tests/app/index.php b/tests/app/index.php index 2e264a6..e558375 100644 --- a/tests/app/index.php +++ b/tests/app/index.php @@ -9,117 +9,7 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
diff --git a/tests/app/notifications.php b/tests/app/notifications.php index 4429ec4..0d0acc3 100644 --- a/tests/app/notifications.php +++ b/tests/app/notifications.php @@ -20,44 +20,45 @@ - \ No newline at end of file diff --git a/tests/app/tables.php b/tests/app/tables.php index 30cf95b..5c8770c 100644 --- a/tests/app/tables.php +++ b/tests/app/tables.php @@ -524,10 +524,13 @@ - \ No newline at end of file diff --git a/tests/load.js b/tests/load.js index 471df61..b22410b 100644 --- a/tests/load.js +++ b/tests/load.js @@ -1,118 +1,134 @@ -(function (jsOMS) -{ - "use strict"; +import { AssetManager } from '../../jsOMS/Asset/AssetManager.js'; +import { Logger } from '../../jsOMS/Log/Logger.js'; +import { CacheManager } from '../../jsOMS/DataStorage/CacheManager.js'; +import { StorageManager } from '../../jsOMS/DataStorage/StorageManager.js'; +import { EventManager } from '../../jsOMS/Event/EventManager.js'; +import { ResponseManager } from '../../jsOMS/Message/Response/ResponseManager.js'; +import { Dispatcher } from '../../jsOMS/Dispatcher/Dispatcher.js'; +import { AccountManager } from '../../jsOMS/Account/AccountManager.js'; +import { UIManager } from '../../jsOMS/UI/UIManager.js'; +import { InputManager } from '../../jsOMS/UI/Input/InputManager.js'; +import { ModuleManager } from '../../jsOMS/Module/ModuleManager.js'; +import { ReadManager } from '../../jsOMS/UI/Input/Voice/ReadManager.js'; +import { VoiceManager } from '../../jsOMS/UI/Input/Voice/VoiceManager.js'; +import { NotificationManager } from '../../jsOMS/Message/Notification/NotificationManager.js'; +import { Http } from '../../jsOMS/Uri/Http.js'; +import { UriFactory } from '../../jsOMS/Uri/UriFactory.js'; - jsOMS.Application = class { - constructor () - { - jsOMS.Autoloader.initPreloaded(); +import { ACTION_EVENTS } from '../../Web/Backend/js/global/ActionEvents.js'; +import { KEYBOARD_EVENTS } from '../../Web/Backend/js/global/KeyboardEvents.js'; +import { MOUSE_EVENTS } from '../../Web/Backend/js/global/MouseEvents.js'; +import { RESPONSE_EVENTS } from '../../Web/Backend/js/global/ResponseEvents.js'; +import { TOUCH_EVENTS } from '../../Web/Backend/js/global/TouchEvents.js'; +import { VOICE_EVENTS } from '../../Web/Backend/js/global/VoiceEvents.js'; - this.logger = jsOMS.Log.Logger.getInstance(); - window.logger = this.logger; +export class Application { + constructor () + { + this.logger = Logger.getInstance(); + window.logger = this.logger; - this.cacheManager = new jsOMS.DataStorage.CacheManager(); - this.storageManager = new jsOMS.DataStorage.StorageManager(); - this.eventManager = new jsOMS.Event.EventManager(); - this.responseManager = new jsOMS.Message.Response.ResponseManager(); - this.dispatcher = new jsOMS.Dispatcher.Dispatcher(); - this.assetManager = new jsOMS.Asset.AssetManager(); - this.acountManager = new jsOMS.Account.AccountManager(); - this.uiManager = new jsOMS.UI.UIManager(this); - this.inputManager = new jsOMS.UI.Input.InputManager(this); - this.moduleManager = new jsOMS.Module.ModuleManager(this); - this.readManager = new jsOMS.UI.Input.Voice.ReadManager(); - this.voiceManager = new jsOMS.UI.Input.Voice.VoiceManager(this); - this.notifyManager = new jsOMS.Message.Notification.NotificationManager(); - this.request = new jsOMS.Uri.Http(window.location.href); + this.cacheManager = new CacheManager(); + this.storageManager = new StorageManager(); + this.eventManager = new EventManager(); + this.responseManager = new ResponseManager(); + this.dispatcher = new Dispatcher(); + this.assetManager = new AssetManager(); + this.acountManager = new AccountManager(); + this.uiManager = new UIManager(this); + this.inputManager = new InputManager(this); + this.moduleManager = new ModuleManager(this); + this.readManager = new ReadManager(); + this.voiceManager = new VoiceManager(this); + this.notifyManager = new NotificationManager(); + this.request = new Http(window.location.href); - this.request.setRootPath( - jsOMS.Uri.Http.parseUrl( - document.getElementsByTagName('base')[0].href - ).path + this.request.setRootPath( + Http.parseUrl( + document.getElementsByTagName('base')[0].href + ).path + ); + + this.setResponseMessages(); + + this.setActions(); + this.setKeyboardActions(); + this.setMouseActions(); + this.setVoiceActions(); + + UriFactory.setupUriBuilder(this.request); + UriFactory.setQuery('/lang', window.location.href.substr(this.request.getBase().length).split('/')[0]); + + this.uiManager.bind(); + }; + + setResponseMessages () + { + /** global: RESPONSE_EVENTS */ + for(let key in RESPONSE_EVENTS) { + if(RESPONSE_EVENTS.hasOwnProperty(key)) { + this.responseManager.add(key, RESPONSE_EVENTS[key]); + } + } + }; + + setActions () + { + /** global: ACTION_EVENTS */ + for(let key in ACTION_EVENTS) { + if(ACTION_EVENTS.hasOwnProperty(key)) { + this.uiManager.getActionManager().add(key, ACTION_EVENTS[key]); + } + } + }; + + setKeyboardActions () + { + /** global: KEYBOARD_EVENTS */ + let length = KEYBOARD_EVENTS.length; + + for(let i = 0; i < length; i++) { + this.inputManager.getKeyboardManager().add( + KEYBOARD_EVENTS[i]['element'], + KEYBOARD_EVENTS[i]['keys'], + KEYBOARD_EVENTS[i]['callback'] ); + } + }; - this.setResponseMessages(); + setMouseActions () + { + /** global: MOUSE_EVENTS */ + let length = MOUSE_EVENTS.length; - this.setActions(); - this.setKeyboardActions(); - this.setMouseActions(); - this.setVoiceActions(); + for(let i = 0; i < length; i++) { + this.inputManager.getMouseManager().add( + MOUSE_EVENTS[i]['element'], + MOUSE_EVENTS[i]['type'], + MOUSE_EVENTS[i]['button'], + MOUSE_EVENTS[i]['callback'], + MOUSE_EVENTS[i]['exact'] + ); + } + }; - jsOMS.Uri.UriFactory.setupUriBuilder(this.request); - jsOMS.Uri.UriFactory.setQuery('/lang', window.location.href.substr(this.request.getBase().length).split('/')[0]); - - this.uiManager.bind(); - }; - - setResponseMessages () - { - /** global: RESPONSE_EVENTS */ - for(let key in RESPONSE_EVENTS) { - if(RESPONSE_EVENTS.hasOwnProperty(key)) { - this.responseManager.add(key, RESPONSE_EVENTS[key]); - } + setVoiceActions () + { + /** global: VOICE_EVENTS */ + for(let key in VOICE_EVENTS) { + if(VOICE_EVENTS.hasOwnProperty(key)) { + this.voiceManager.add(key, VOICE_EVENTS[key]); } - }; + } - setActions () - { - /** global: ACTION_EVENTS */ - for(let key in ACTION_EVENTS) { - if(ACTION_EVENTS.hasOwnProperty(key)) { - this.uiManager.getActionManager().add(key, ACTION_EVENTS[key]); - } - } - }; + this.voiceManager.setup(); + this.voiceManager.start(); + }; +}; - setKeyboardActions () - { - /** global: KEYBOARD_EVENTS */ - let length = KEYBOARD_EVENTS.length; - - for(let i = 0; i < length; i++) { - this.inputManager.getKeyboardManager().add( - KEYBOARD_EVENTS[i]['element'], - KEYBOARD_EVENTS[i]['keys'], - KEYBOARD_EVENTS[i]['callback'] - ); - } - }; - - setMouseActions () - { - /** global: MOUSE_EVENTS */ - let length = MOUSE_EVENTS.length; - - for(let i = 0; i < length; i++) { - this.inputManager.getMouseManager().add( - MOUSE_EVENTS[i]['element'], - MOUSE_EVENTS[i]['type'], - MOUSE_EVENTS[i]['button'], - MOUSE_EVENTS[i]['callback'], - MOUSE_EVENTS[i]['exact'] - ); - } - }; - - setVoiceActions () - { - /** global: VOICE_EVENTS */ - for(let key in VOICE_EVENTS) { - if(VOICE_EVENTS.hasOwnProperty(key)) { - this.voiceManager.add(key, VOICE_EVENTS[key]); - } - } - - this.voiceManager.setup(); - this.voiceManager.start(); - }; - } -}(window.jsOMS = window.jsOMS || {})); - -jsOMS.ready(function () -{ +jsOMS.ready(function () { "use strict"; /** global: jsOMS */ - window.omsApp = new jsOMS.Application(); + window.omsApp = new Application(); });