(target: any, data: LView | LContext)
| 189 | * directive or DOM node instance) using monkey-patching. |
| 190 | */ |
| 191 | export function attachPatchData(target: any, data: LView | LContext) { |
| 192 | ngDevMode && assertDefined(target, 'Target expected'); |
| 193 | // Only attach the ID of the view in order to avoid memory leaks (see #41047). We only do this |
| 194 | // for `LView`, because we have control over when an `LView` is created and destroyed, whereas |
| 195 | // we can't know when to remove an `LContext`. |
| 196 | if (isLView(data)) { |
| 197 | target[MONKEY_PATCH_KEY_NAME] = data[ID]; |
| 198 | registerLView(data); |
| 199 | } else { |
| 200 | target[MONKEY_PATCH_KEY_NAME] = data; |
| 201 | } |
| 202 | } |
| 203 | |
| 204 | /** |
| 205 | * Returns the monkey-patch value data present on the target (which could be |
no test coverage detected
searching dependent graphs…