File tree 1 file changed +8
-4
lines changed 1 file changed +8
-4
lines changed Original file line number Diff line number Diff line change @@ -17,15 +17,19 @@ Radio.noConflict = function () {
17
17
// get around the issues of lack of warnings when events are mis-typed.
18
18
Radio . DEBUG = false ;
19
19
20
+ // Format debug text.
21
+ Radio . _debugText = function ( warning , eventName , channelName ) {
22
+ return warning + ( channelName ? ' on the ' + channelName + ' channel' : '' ) +
23
+ ': "' + eventName + '"' ;
24
+ } ;
25
+
20
26
// This is the method that's called when an unregistered event was called.
21
27
// By default, it logs warning to the console. By overriding this you could
22
28
// make it throw an Error, for instance. This would make firing a nonexistent event
23
29
// have the same consequence as firing a nonexistent method on an Object.
24
30
Radio . debugLog = function ( warning , eventName , channelName ) {
25
- if ( ! Radio . DEBUG ) { return ; }
26
- var channelText = channelName ? ' on the ' + channelName + ' channel' : '' ;
27
- if ( console && console . warn ) {
28
- console . warn ( warning + channelText + ': "' + eventName + '"' ) ;
31
+ if ( Radio . DEBUG && console && console . warn ) {
32
+ console . warn ( Radio . _debugText ( warning , eventName , channelName ) ) ;
29
33
}
30
34
} ;
31
35
You can’t perform that action at this time.
0 commit comments