1
0
mirror of https://github.com/haiwen/seahub.git synced 2025-09-17 15:53:28 +00:00

update group in real time (#7141)

This commit is contained in:
Jerry Ren
2024-12-04 17:49:42 +08:00
committed by GitHub
parent 3a4db4bf70
commit 90764f9520
12 changed files with 305 additions and 75 deletions

View File

@@ -3,6 +3,11 @@ export const EVENT_BUS_TYPE = {
CURRENT_LIBRARY_CHANGED: 'current_library_changed',
SEARCH_LIBRARY_CONTENT: 'search_library_content',
// group
ADD_NEW_GROUP: 'add_new_group',
ADD_SHARED_REPO_INO_GROUP: 'add_shared_repo_into_group',
UNSHARE_REPO_TO_GROUP: 'unshare_repo_to_group',
RESTORE_IMAGE: 'restore_image',
OPEN_MARKDOWN: 'open_markdown',
};

View File

@@ -1,5 +1,16 @@
class EventBus {
subscribers = {};
constructor() {
this.instance = null;
this.subscribers = {};
}
static getInstance() {
if (this.instance) return this.instance;
this.instance = new EventBus();
return this.instance;
}
subscribe(type, handler) {
if (!this.subscribers[type]) {