mirror of
https://github.com/zoriya/flood.git
synced 2025-12-06 07:16:18 +00:00
server: replace explicit binds with arrow functions
This commit is contained in:
@@ -1,5 +1,4 @@
|
||||
import Datastore from 'nedb';
|
||||
import debounce from 'lodash/debounce';
|
||||
import path from 'path';
|
||||
|
||||
import type {Notification, NotificationCount, NotificationFetchOptions} from '@shared/types/Notification';
|
||||
@@ -20,8 +19,6 @@ class NotificationService extends BaseService<NotificationServiceEvents> {
|
||||
constructor(...args: ConstructorParameters<typeof BaseService>) {
|
||||
super(...args);
|
||||
|
||||
this.emitUpdate = debounce(this.emitUpdate.bind(this), 100);
|
||||
|
||||
this.onServicesUpdated = () => {
|
||||
this.countNotifications();
|
||||
};
|
||||
@@ -77,12 +74,12 @@ class NotificationService extends BaseService<NotificationServiceEvents> {
|
||||
});
|
||||
}
|
||||
|
||||
emitUpdate() {
|
||||
emitUpdate = () => {
|
||||
this.emit('NOTIFICATION_COUNT_CHANGE', {
|
||||
id: Date.now(),
|
||||
data: this.count,
|
||||
});
|
||||
}
|
||||
};
|
||||
|
||||
getNotificationCount() {
|
||||
return this.count;
|
||||
|
||||
Reference in New Issue
Block a user