Skip to content
This repository was archived by the owner on Feb 23, 2021. It is now read-only.

Commit 3b133ae

Browse files
committed
Port ComputedNotification to mobx 4
1 parent 75c59b5 commit 3b133ae

File tree

1 file changed

+10
-10
lines changed

1 file changed

+10
-10
lines changed

src/computed/notification.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -2,20 +2,20 @@
22
* @fileOverview computed values that are used in notification UI components.
33
*/
44

5-
import { computed, extendObservable } from 'mobx';
5+
import { extendObservable } from 'mobx';
66
import { toCaps, formatNumber } from '../helper';
77

88
const ComputedNotification = store => {
99
extendObservable(store, {
10-
lastNotification: computed(() => {
10+
get lastNotification() {
1111
const { notifications: nots } = store;
1212
return nots.length ? nots[nots.length - 1] : null;
13-
}),
14-
displayNotification: computed(() => {
13+
},
14+
get displayNotification() {
1515
const { lastNotification: last } = store;
1616
return last ? last.display : false;
17-
}),
18-
computedNotifications: computed(() => {
17+
},
18+
get computedNotifications() {
1919
const { notifications } = store;
2020
const all = [];
2121
notifications.forEach(n => {
@@ -31,10 +31,10 @@ const ComputedNotification = store => {
3131
n.dateTimeLabel = n.date.toLocaleString();
3232
});
3333
return all;
34-
}),
35-
notificationCountLabel: computed(() =>
36-
formatNumber(store.computedNotifications.length)
37-
),
34+
},
35+
get notificationCountLabel() {
36+
return formatNumber(store.computedNotifications.length);
37+
},
3838
});
3939
};
4040

0 commit comments

Comments
 (0)