From dec3ed1556454a648044574f36ad8749972ff4b5 Mon Sep 17 00:00:00 2001 From: walrusfruitcake Date: Tue, 11 Jul 2017 06:37:11 -0400 Subject: [PATCH] move augmentClass definition above SyntheticEvent Proxy replacement (#10011) --- .../shared/stack/event/SyntheticEvent.js | 49 ++++++++++--------- 1 file changed, 27 insertions(+), 22 deletions(-) diff --git a/src/renderers/shared/stack/event/SyntheticEvent.js b/src/renderers/shared/stack/event/SyntheticEvent.js index 8325c734e023..aee772446bc0 100644 --- a/src/renderers/shared/stack/event/SyntheticEvent.js +++ b/src/renderers/shared/stack/event/SyntheticEvent.js @@ -210,6 +210,33 @@ Object.assign(SyntheticEvent.prototype, { SyntheticEvent.Interface = EventInterface; +/** + * Helper to reduce boilerplate when creating subclasses. + * + * @param {function} Class + * @param {?object} Interface + */ +SyntheticEvent.augmentClass = function(Class, Interface) { + var Super = this; + + var E = function() {}; + E.prototype = Super.prototype; + var prototype = new E(); + + Object.assign(prototype, Class.prototype); + Class.prototype = prototype; + Class.prototype.constructor = Class; + + Class.Interface = Object.assign({}, Super.Interface, Interface); + Class.augmentClass = Super.augmentClass; + + PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); +}; + +/** Proxying after everything set on SyntheticEvent + * to resolve Proxy issue on some WebKit browsers + * in which some Event properties are set to undefined (GH#10010) + */ if (__DEV__) { if (isProxySupported) { /*eslint-disable no-func-assign */ @@ -243,28 +270,6 @@ if (__DEV__) { /*eslint-enable no-func-assign */ } } -/** - * Helper to reduce boilerplate when creating subclasses. - * - * @param {function} Class - * @param {?object} Interface - */ -SyntheticEvent.augmentClass = function(Class, Interface) { - var Super = this; - - var E = function() {}; - E.prototype = Super.prototype; - var prototype = new E(); - - Object.assign(prototype, Class.prototype); - Class.prototype = prototype; - Class.prototype.constructor = Class; - - Class.Interface = Object.assign({}, Super.Interface, Interface); - Class.augmentClass = Super.augmentClass; - - PooledClass.addPoolingTo(Class, PooledClass.fourArgumentPooler); -}; PooledClass.addPoolingTo(SyntheticEvent, PooledClass.fourArgumentPooler);