From 2b4762f18469a12f4056e18b5e6b76b2babb5579 Mon Sep 17 00:00:00 2001 From: David Aurelio Date: Tue, 21 Mar 2017 09:52:31 -0700 Subject: [PATCH] Only use `EventValidator` in development mode Summary: Only pulls in `EventValidator` for development mode, as warnings about invalid events are pointless in production builds. Reviewed By: javache Differential Revision: D4745852 fbshipit-source-id: dbab1026df35d54a82e1e620fac08304c58fbeae --- Libraries/EventEmitter/mixInEventEmitter.js | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/Libraries/EventEmitter/mixInEventEmitter.js b/Libraries/EventEmitter/mixInEventEmitter.js index 27b6726ed..d5db027bb 100644 --- a/Libraries/EventEmitter/mixInEventEmitter.js +++ b/Libraries/EventEmitter/mixInEventEmitter.js @@ -14,7 +14,6 @@ const EventEmitter = require('EventEmitter'); const EventEmitterWithHolding = require('EventEmitterWithHolding'); const EventHolder = require('EventHolder'); -const EventValidator = require('EventValidator'); const invariant = require('fbjs/lib/invariant'); const keyOf = require('fbjs/lib/keyOf'); @@ -119,7 +118,10 @@ const EventEmitterMixin = { __getEventEmitter: function() { if (!this.__eventEmitter) { let emitter = new EventEmitter(); - emitter = EventValidator.addValidation(emitter, this.__types); + if (__DEV__) { + const EventValidator = require('EventValidator'); + emitter = EventValidator.addValidation(emitter, this.__types); + } const holder = new EventHolder(); this.__eventEmitter = new EventEmitterWithHolding(emitter, holder);