mirror of
https://github.com/zoriya/flood.git
synced 2026-05-27 09:01:58 +00:00
Display loading indicator for entire application, rather than
individual components.
This commit is contained in:
@@ -12,6 +12,7 @@ class UIStoreClass extends BaseStore {
|
||||
|
||||
this.activeContextMenu = null;
|
||||
this.activeModal = null;
|
||||
this.dependencies = [];
|
||||
this.latestTorrentLocation = null;
|
||||
this.torrentDetailsHash = null;
|
||||
this.torrentDetailsOpen = false;
|
||||
@@ -63,10 +64,36 @@ class UIStoreClass extends BaseStore {
|
||||
this.emit(EventTypes.UI_TORRENT_DETAILS_OPEN_CHANGE);
|
||||
}
|
||||
|
||||
hasSatisfiedDependencies() {
|
||||
return this.dependencies.length === 0;
|
||||
}
|
||||
|
||||
isTorrentDetailsOpen() {
|
||||
return this.torrentDetailsOpen;
|
||||
}
|
||||
|
||||
registerDependency(ids) {
|
||||
if (!Array.isArray(ids)) {
|
||||
ids = [ids];
|
||||
}
|
||||
|
||||
ids.forEach((id) => {
|
||||
if (this.dependencies.indexOf(id) === -1) {
|
||||
this.dependencies.push(id);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
satisfyDependency(id) {
|
||||
let dependencyIndex = this.dependencies.indexOf(id);
|
||||
|
||||
if (dependencyIndex > -1) {
|
||||
this.dependencies.splice(dependencyIndex, 1);
|
||||
}
|
||||
|
||||
this.verifyDependencies();
|
||||
}
|
||||
|
||||
setActiveContextMenu(contextMenu = {}) {
|
||||
this.activeContextMenu = contextMenu;
|
||||
this.emit(EventTypes.UI_CONTEXT_MENU_CHANGE);
|
||||
@@ -76,6 +103,12 @@ class UIStoreClass extends BaseStore {
|
||||
this.activeModal = modal;
|
||||
this.emit(EventTypes.UI_MODAL_CHANGE);
|
||||
}
|
||||
|
||||
verifyDependencies() {
|
||||
if (this.dependencies.length === 0) {
|
||||
this.emit(EventTypes.UI_DEPENDENCIES_LOADED);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
let UIStore = new UIStoreClass();
|
||||
|
||||
Reference in New Issue
Block a user