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
This commit is contained in:
David Aurelio 2017-03-21 09:52:31 -07:00 committed by Facebook Github Bot
parent a34956f2fb
commit 2b4762f184
1 changed files with 4 additions and 2 deletions

View File

@ -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);