(state: State, action: Action)
| 151 | } |
| 152 | |
| 153 | function reducer(state: State, action: Action): State { |
| 154 | switch (action.type) { |
| 155 | case 'update': { |
| 156 | return { |
| 157 | state: 'loading', |
| 158 | src: action.src, |
| 159 | startTime: Date.now(), |
| 160 | loadTime: 0 |
| 161 | }; |
| 162 | } |
| 163 | case 'loaded': |
| 164 | case 'error': { |
| 165 | return { |
| 166 | ...state, |
| 167 | state: action.type |
| 168 | }; |
| 169 | } |
| 170 | case 'revealed': { |
| 171 | return { |
| 172 | ...state, |
| 173 | state: 'revealed', |
| 174 | loadTime: Date.now() - state.startTime |
| 175 | }; |
| 176 | } |
| 177 | default: |
| 178 | return state; |
| 179 | } |
| 180 | } |
| 181 | |
| 182 | const wrapperStyles = style({ |
| 183 | backgroundColor: 'gray-100', |
nothing calls this directly
no outgoing calls
no test coverage detected