mirror of
https://github.com/PR0M3TH3AN/bitvid.git
synced 2026-11-06 12:52:26 +00:00
Refactor app orchestrator into Application with dependency injection
This commit is contained in:
1 parent
ef6b8bf1cf
commit
cf34e28a47
17 files changed
+525
-375
No files matched your search
@@ -0,0 +1,24 @@
|
||||
// js/applicationContext.js
|
||||
|
||||
let applicationInstance = null;
|
||||
let readyPromise = Promise.resolve();
|
||||
|
||||
export function setApplication(app) {
|
||||
applicationInstance = app || null;
|
||||
}
|
||||
|
||||
export function getApplication() {
|
||||
return applicationInstance;
|
||||
}
|
||||
|
||||
export function setApplicationReady(promise) {
|
||||
if (promise && typeof promise.then === "function") {
|
||||
readyPromise = promise;
|
||||
} else {
|
||||
readyPromise = Promise.resolve(promise);
|
||||
}
|
||||
}
|
||||
|
||||
export function getApplicationReady() {
|
||||
return readyPromise;
|
||||
}
|
||||
Reference in new issue
Block a user