Permalink
Browse files

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
  • Loading branch information...
davidaurelio authored and facebook-github-bot committed Mar 21, 2017
1 parent a34956f commit 2b4762f18469a12f4056e18b5e6b76b2babb5579
Showing with 4 additions and 2 deletions.
  1. +4 −2 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);

0 comments on commit 2b4762f

Please sign in to comment.