@@ -35,7 +35,7 @@ var eventSplitter = /\s+/;
3535// Commands. It's borrowed from Backbone.Events. It differs from Backbone's overload 
3636// API (which is used in Backbone.Events) in that it doesn't support space-separated 
3737// event names. 
38- function   eventsApi ( obj ,  action ,  name ,  rest )  { 
38+ Radio . _eventsApi   =   function ( obj ,  action ,  name ,  rest )  { 
3939  if  ( ! name )  { 
4040    return  false ; 
4141  } 
@@ -60,10 +60,10 @@ function eventsApi(obj, action, name, rest) {
6060  } 
6161
6262  return  false ; 
63- } 
63+ } ; 
6464
6565// An optimized way to execute callbacks. 
66- function   callHandler ( callback ,  context ,  args )  { 
66+ Radio . _callHandler   =   function ( callback ,  context ,  args )  { 
6767  var  a1  =  args [ 0 ] ,  a2  =  args [ 1 ] ,  a3  =  args [ 2 ] ; 
6868  switch ( args . length )  { 
6969    case  0 : return  callback . call ( context ) ; 
@@ -72,7 +72,7 @@ function callHandler(callback, context, args) {
7272    case  3 : return  callback . call ( context ,  a1 ,  a2 ,  a3 ) ; 
7373    default : return  callback . apply ( context ,  args ) ; 
7474  } 
75- } 
75+ } ; 
7676
7777// A helper used by `off` methods to the handler from the store 
7878function  removeHandler ( store ,  name ,  callback ,  context )  { 
@@ -163,7 +163,7 @@ Radio.Commands = {
163163  // Issue a command 
164164  command : function ( name )  { 
165165    var  args  =  _ . rest ( arguments ) ; 
166-     if  ( eventsApi ( this ,  'command' ,  name ,  args ) )  { 
166+     if  ( Radio . _eventsApi ( this ,  'command' ,  name ,  args ) )  { 
167167      return  this ; 
168168    } 
169169    var  channelName  =  this . channelName ; 
@@ -178,7 +178,7 @@ Radio.Commands = {
178178    if  ( commands  &&  ( commands [ name ]  ||  commands [ 'default' ] ) )  { 
179179      var  handler  =  commands [ name ]  ||  commands [ 'default' ] ; 
180180      args  =  commands [ name ]  ? args  : arguments ; 
181-       callHandler ( handler . callback ,  handler . context ,  args ) ; 
181+       Radio . _callHandler ( handler . callback ,  handler . context ,  args ) ; 
182182    }  else  { 
183183      Radio . debugLog ( 'An unhandled command was fired' ,  name ,  channelName ) ; 
184184    } 
@@ -188,7 +188,7 @@ Radio.Commands = {
188188
189189  // Register a handler for a command. 
190190  comply : function ( name ,  callback ,  context )  { 
191-     if  ( eventsApi ( this ,  'comply' ,  name ,  [ callback ,  context ] ) )  { 
191+     if  ( Radio . _eventsApi ( this ,  'comply' ,  name ,  [ callback ,  context ] ) )  { 
192192      return  this ; 
193193    } 
194194    this . _commands  ||  ( this . _commands  =  { } ) ; 
@@ -207,7 +207,7 @@ Radio.Commands = {
207207
208208  // Register a handler for a command that happens just once. 
209209  complyOnce : function ( name ,  callback ,  context )  { 
210-     if  ( eventsApi ( this ,  'complyOnce' ,  name ,  [ callback ,  context ] ) )  { 
210+     if  ( Radio . _eventsApi ( this ,  'complyOnce' ,  name ,  [ callback ,  context ] ) )  { 
211211      return  this ; 
212212    } 
213213    var  self  =  this ; 
@@ -222,7 +222,7 @@ Radio.Commands = {
222222
223223  // Remove handler(s) 
224224  stopComplying : function ( name ,  callback ,  context )  { 
225-     if  ( eventsApi ( this ,  'stopComplying' ,  name ) )  { 
225+     if  ( Radio . _eventsApi ( this ,  'stopComplying' ,  name ) )  { 
226226      return  this ; 
227227    } 
228228
@@ -253,7 +253,7 @@ Radio.Requests = {
253253  // Make a request 
254254  request : function ( name )  { 
255255    var  args  =  _ . rest ( arguments ) ; 
256-     var  results  =  eventsApi ( this ,  'request' ,  name ,  args ) ; 
256+     var  results  =  Radio . _eventsApi ( this ,  'request' ,  name ,  args ) ; 
257257    if  ( results )  { 
258258      return  results ; 
259259    } 
@@ -269,15 +269,15 @@ Radio.Requests = {
269269    if  ( requests  &&  ( requests [ name ]  ||  requests [ 'default' ] ) )  { 
270270      var  handler  =  requests [ name ]  ||  requests [ 'default' ] ; 
271271      args  =  requests [ name ]  ? args  : arguments ; 
272-       return  callHandler ( handler . callback ,  handler . context ,  args ) ; 
272+       return  Radio . _callHandler ( handler . callback ,  handler . context ,  args ) ; 
273273    }  else  { 
274274      Radio . debugLog ( 'An unhandled request was fired' ,  name ,  channelName ) ; 
275275    } 
276276  } , 
277277
278278  // Set up a handler for a request 
279279  reply : function ( name ,  callback ,  context )  { 
280-     if  ( eventsApi ( this ,  'reply' ,  name ,  [ callback ,  context ] ) )  { 
280+     if  ( Radio . _eventsApi ( this ,  'reply' ,  name ,  [ callback ,  context ] ) )  { 
281281      return  this ; 
282282    } 
283283
@@ -297,7 +297,7 @@ Radio.Requests = {
297297
298298  // Set up a handler that can only be requested once 
299299  replyOnce : function ( name ,  callback ,  context )  { 
300-     if  ( eventsApi ( this ,  'replyOnce' ,  name ,  [ callback ,  context ] ) )  { 
300+     if  ( Radio . _eventsApi ( this ,  'replyOnce' ,  name ,  [ callback ,  context ] ) )  { 
301301      return  this ; 
302302    } 
303303
@@ -313,7 +313,7 @@ Radio.Requests = {
313313
314314  // Remove handler(s) 
315315  stopReplying : function ( name ,  callback ,  context )  { 
316-     if  ( eventsApi ( this ,  'stopReplying' ,  name ) )  { 
316+     if  ( Radio . _eventsApi ( this ,  'stopReplying' ,  name ) )  { 
317317      return  this ; 
318318    } 
319319
0 commit comments