(
items: INotificationItem<T>[]
)
| 104 | } |
| 105 | |
| 106 | public add<T>( |
| 107 | items: INotificationItem<T>[] |
| 108 | ): null | INotificationItem<T>[] { |
| 109 | const { data = [] } = this.state; |
| 110 | |
| 111 | if (items && items.length) { |
| 112 | items.forEach((item) => { |
| 113 | if (item.id === undefined) item.id = randomId(); |
| 114 | item.status = NotificationStatus.WaitRead; |
| 115 | }); |
| 116 | const arr = [...data, ...items]; |
| 117 | this.setState({ |
| 118 | data: arr, |
| 119 | }); |
| 120 | return items; |
| 121 | } |
| 122 | return null; |
| 123 | } |
| 124 | |
| 125 | public clear() { |
| 126 | this.setState({ |