Permalink
Browse files

Modified so that any provided handlers will receive the extra handler…

…Args if provided
  • Loading branch information...
1 parent 3ec08e1 commit f5a7aba0d3eb574052ed37b8e880533ca6804ad0 @bclinkinbeard bclinkinbeard committed Nov 30, 2010
Showing with 42 additions and 18 deletions.
  1. +42 −18 src/org/swizframework/utils/services/SwizURLRequest.as
@@ -73,36 +73,60 @@ package org.swizframework.utils.services
}
} );
- loader.addEventListener( IOErrorEvent.IO_ERROR, function( e:IOErrorEvent ):void
- {
- if ( faultHandler != null )
- faultHandler( e );
- else {
- // todo: what if there is no fault handler applied to dynamic url request
- }
- } );
- loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, function( e:SecurityErrorEvent ):void
- {
- if ( faultHandler != null )
- faultHandler( e );
- else {
- // todo: what if there is no fault handler applied to dynamic url request
- }
- } );
+ if( faultHandler != null )
+ {
+ loader.addEventListener( IOErrorEvent.IO_ERROR, function( e:IOErrorEvent ):void
+ {
+ if( handlerArgs == null )
+ {
+ faultHandler( e );
+ }
+ else
+ {
+ faultHandler.apply( null, [ e ].concat( handlerArgs ) );
+ }
+ } );
+
+ loader.addEventListener( SecurityErrorEvent.SECURITY_ERROR, function( e:SecurityErrorEvent ):void
+ {
+ if( handlerArgs == null )
+ {
+ faultHandler( e );
+ }
+ else
+ {
+ faultHandler.apply( null, [ e ].concat( handlerArgs ) );
+ }
+ } );
+ }
if( progressHandler != null )
{
loader.addEventListener( ProgressEvent.PROGRESS, function( e:ProgressEvent ):void
{
- progressHandler( e );
+ if( handlerArgs == null )
+ {
+ progressHandler( e );
+ }
+ else
+ {
+ progressHandler.apply( null, [ e ].concat( handlerArgs ) );
+ }
} );
}
if( httpStatusHandler != null )
{
loader.addEventListener( HTTPStatusEvent.HTTP_STATUS, function( e:HTTPStatusEvent ):void
{
- httpStatusHandler( e );
+ if( handlerArgs == null )
+ {
+ httpStatusHandler( e );
+ }
+ else
+ {
+ httpStatusHandler.apply( null, [ e ].concat( handlerArgs ) );
+ }
} );
}

0 comments on commit f5a7aba

Please sign in to comment.