(debugInfo?: DebuggerEventExtraInfo)
| 171 | } |
| 172 | |
| 173 | notify(debugInfo?: DebuggerEventExtraInfo): void { |
| 174 | startBatch() |
| 175 | try { |
| 176 | if (__DEV__) { |
| 177 | // subs are notified and batched in reverse-order and then invoked in |
| 178 | // original order at the end of the batch, but onTrigger hooks should |
| 179 | // be invoked in original order here. |
| 180 | for (let head = this.subsHead; head; head = head.nextSub) { |
| 181 | if (head.sub.onTrigger && !(head.sub.flags & EffectFlags.NOTIFIED)) { |
| 182 | head.sub.onTrigger( |
| 183 | extend( |
| 184 | { |
| 185 | effect: head.sub, |
| 186 | }, |
| 187 | debugInfo, |
| 188 | ), |
| 189 | ) |
| 190 | } |
| 191 | } |
| 192 | } |
| 193 | for (let link = this.subs; link; link = link.prevSub) { |
| 194 | if (link.sub.notify()) { |
| 195 | // if notify() returns `true`, this is a computed. Also call notify |
| 196 | // on its dep - it's called here instead of inside computed's notify |
| 197 | // in order to reduce call stack depth. |
| 198 | ;(link.sub as ComputedRefImpl).dep.notify() |
| 199 | } |
| 200 | } |
| 201 | } finally { |
| 202 | endBatch() |
| 203 | } |
| 204 | } |
| 205 | } |
| 206 | |
| 207 | function addSub(link: Link) { |
no test coverage detected