* Helper to nullify syntheticEvent instance properties when destructing * * @param {String} propName * @param {?object} getVal * @return {object} defineProperty object
(propName, getVal)
| 3313 | * @return {object} defineProperty object |
| 3314 | */ |
| 3315 | function getPooledWarningPropertyDefinition(propName, getVal) { |
| 3316 | var isFunction = typeof getVal === 'function'; |
| 3317 | return { |
| 3318 | configurable: true, |
| 3319 | set: set, |
| 3320 | get: get |
| 3321 | }; |
| 3322 | |
| 3323 | function set(val) { |
| 3324 | var action = isFunction ? 'setting the method' : 'setting the property'; |
| 3325 | warn(action, 'This is effectively a no-op'); |
| 3326 | return val; |
| 3327 | } |
| 3328 | |
| 3329 | function get() { |
| 3330 | var action = isFunction ? 'accessing the method' : 'accessing the property'; |
| 3331 | var result = isFunction ? 'This is a no-op function' : 'This is set to null'; |
| 3332 | warn(action, result); |
| 3333 | return getVal; |
| 3334 | } |
| 3335 | |
| 3336 | function warn(action, result) { |
| 3337 | var warningCondition = false; |
| 3338 | warning(warningCondition, "This synthetic event is reused for performance reasons. If you're seeing this, " + "you're %s `%s` on a released/nullified synthetic event. %s. " + 'If you must keep the original synthetic event around, use event.persist(). ' + 'See https://fb.me/react-event-pooling for more information.', action, propName, result); |
| 3339 | } |
| 3340 | } |
| 3341 | |
| 3342 | function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { |
| 3343 | var EventConstructor = this; |