forked from facebook/react
-
Notifications
You must be signed in to change notification settings - Fork 105
/
Copy pathinjectTapEventPlugin.js
27 lines (21 loc) · 1.05 KB
/
injectTapEventPlugin.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
var invariant = require('fbjs/lib/invariant');
var defaultClickRejectionStrategy = require('./defaultClickRejectionStrategy');
var alreadyInjected = false;
module.exports = function injectTapEventPlugin(strategyOverrides) {
strategyOverrides = strategyOverrides || {}
var shouldRejectClick = strategyOverrides.shouldRejectClick || defaultClickRejectionStrategy;
if (process.env.NODE_ENV !== 'production') {
invariant(
!alreadyInjected,
'injectTapEventPlugin(): Can only be called once per application lifecycle.\n\n\
It is recommended to call injectTapEventPlugin() just before you call \
ReactDOM.render(). If you are using an external library which calls injectTapEventPlugin() \
itself, please contact the maintainer as it shouldn\'t be called in library code and \
should be injected by the application.'
)
}
alreadyInjected = true;
require('react-dom').__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.EventPluginHub.injection.injectEventPluginsByName({
'TapEventPlugin': require('./TapEventPlugin.js')(shouldRejectClick)
});
};