MCPcopy Create free account
hub / github.com/DTStack/molecule / add

Method add

src/services/notificationService.ts:106–123  ·  view source on GitHub ↗
(
        items: INotificationItem<T>[]
    )

Source from the content-addressed store, hash-verified

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({

Callers

nothing calls this directly

Calls 2

randomIdFunction · 0.90
setStateMethod · 0.80

Tested by

no test coverage detected