Created
July 9, 2018 05:55
-
-
Save ManasJayanth/fa19fbcf60afe1d5ca2800f78bc4b00c to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commitUpdate( | |
domElement, | |
updatePayload, | |
type, | |
oldProps, | |
newProps, | |
internalInstanceHandle | |
) { | |
updatePayload.forEach(update => { | |
Object.keys(update).forEach(key => { | |
if (key === 'onClick') { | |
domElement.__ourVeryHackCacheOfEventListeners.forEach(listener => { // To prevent leak | |
domElement.removeEventListener('click', listener) | |
}) | |
domElement.__ourVeryHackCacheOfEventListeners = [ update[key] ]; | |
domElement.addEventListener('click', update[key]) | |
} else { | |
domElement[key] = update[key]; | |
} | |
}) | |
}) | |
}, |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment