(next)
| 11 | return { |
| 12 | getSnapshot: () => current, |
| 13 | set(next) { |
| 14 | if (Object.is(current, next)) { |
| 15 | return; |
| 16 | } |
| 17 | current = next; |
| 18 | for (const listener of listeners) { |
| 19 | listener(); |
| 20 | } |
| 21 | }, |
| 22 | subscribe(listener) { |
| 23 | listeners.add(listener); |
| 24 | return () => { |