(thing, propOrHandler?, handler?)
| 35 | handler: ReadInterceptor<any> |
| 36 | ): Lambda |
| 37 | export function interceptReads(thing, propOrHandler?, handler?): Lambda { |
| 38 | let target |
| 39 | if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { |
| 40 | target = getAdministration(thing) |
| 41 | } else if (isObservableObject(thing)) { |
| 42 | if (__DEV__ && !isStringish(propOrHandler)) { |
| 43 | return die( |
| 44 | `InterceptReads can only be used with a specific property, not with an object in general` |
| 45 | ) |
| 46 | } |
| 47 | target = getAdministration(thing, propOrHandler) |
| 48 | } else if (__DEV__) { |
| 49 | return die(`Expected observable map, object or array as first array`) |
| 50 | } |
| 51 | if (__DEV__ && target.dehancer !== undefined) { |
| 52 | return die(`An intercept reader was already established`) |
| 53 | } |
| 54 | target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler |
| 55 | return () => { |
| 56 | target.dehancer = undefined |
| 57 | } |
| 58 | } |
nothing calls this directly
no test coverage detected
searching dependent graphs…