@samitouri / QOS-React-2 / commits / eb36b57079

Use warning module

Charles Marsh committed Aug 23, 2014 at 09:25 UTC eb36b57079f520a8ee690ba02559d6ce24d7a03f
2 files changed +10 -11
src/browser/__tests__/ReactBrowserEventEmitter-test.js
+2 -2
@@ -275,8 +275,8 @@ describe('ReactBrowserEventEmitter', function() {
275 expect(idCallOrder[0]).toBe(getID(CHILD));
276 expect(console.warn.calls.length).toEqual(1);
277 expect(console.warn.calls[0].args[0]).toBe(
278 - 'Returning `false` from an event handler is deprecated and will ' +
279 - 'be ignored in a future release. Instead, manually call ' +
278 + 'Warning: Returning `false` from an event handler is deprecated and ' +
279 + 'will be ignored in a future release. Instead, manually call ' +
280 'e.stopPropagation() or e.preventDefault(), as appropriate.'
281 );
282 });
src/browser/eventPlugins/SimpleEventPlugin.js
+8 -9
@@ -35,6 +35,7 @@ var getEventCharCode = require('getEventCharCode');
35
36 var invariant = require('invariant');
37 var keyOf = require('keyOf');
38 +var warning = require('warning');
39
40 var topLevelTypes = EventConstants.topLevelTypes;
41
@@ -309,15 +310,13 @@ var SimpleEventPlugin = {
310 */
311 executeDispatch: function(event, listener, domID) {
312 var returnValue = EventPluginUtils.executeDispatch(event, listener, domID);
312 - if (__DEV__) {
313 - if (typeof returnValue === 'boolean') {
314 - console.warn(
315 - 'Returning `false` from an event handler is deprecated and will ' +
316 - 'be ignored in a future release. Instead, manually call ' +
317 - 'e.stopPropagation() or e.preventDefault(), as appropriate.'
318 - );
319 - }
320 - }
313 +
314 + warning(
315 + typeof returnValue !== 'boolean',
316 + 'Returning `false` from an event handler is deprecated and will be ' +
317 + 'ignored in a future release. Instead, manually call ' +
318 + 'e.stopPropagation() or e.preventDefault(), as appropriate.'
319 + );
320
321 if (returnValue === false) {
322 event.stopPropagation();