* Helper to nullify syntheticEvent instance properties when destructing * * @param {String} propName * @param {?object} getVal * @return {object} defineProperty object
(propName, getVal)
| 3062 | * @return {object} defineProperty object |
| 3063 | */ |
| 3064 | function getPooledWarningPropertyDefinition(propName, getVal) { |
| 3065 | var isFunction = typeof getVal === 'function'; |
| 3066 | return { |
| 3067 | configurable: true, |
| 3068 | set: set, |
| 3069 | get: get |
| 3070 | }; |
| 3071 | |
| 3072 | function set(val) { |
| 3073 | var action = isFunction ? 'setting the method' : 'setting the property'; |
| 3074 | warn(action, 'This is effectively a no-op'); |
| 3075 | return val; |
| 3076 | } |
| 3077 | |
| 3078 | function get() { |
| 3079 | var action = isFunction ? 'accessing the method' : 'accessing the property'; |
| 3080 | var result = isFunction ? 'This is a no-op function' : 'This is set to null'; |
| 3081 | warn(action, result); |
| 3082 | return getVal; |
| 3083 | } |
| 3084 | |
| 3085 | function warn(action, result) { |
| 3086 | var warningCondition = false; |
| 3087 | 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); |
| 3088 | } |
| 3089 | } |
| 3090 | |
| 3091 | function getPooledEvent(dispatchConfig, targetInst, nativeEvent, nativeInst) { |
| 3092 | var EventConstructor = this; |