server: replace explicit binds with arrow functions

This commit is contained in:
Jesse Chan
2020-11-02 19:32:33 +08:00
parent 5bcce59771
commit 017b9d159d
10 changed files with 55 additions and 103 deletions

View File

@@ -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;