flex-issues mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "dimitri kara (JIRA)" <j...@apache.org>
Subject [jira] [Created] (FLEX-34818) FlexUnit SequenceCaller prevent function call on non event-dipatcher object for no reason
Date Tue, 07 Apr 2015 09:25:14 GMT
dimitri kara created FLEX-34818:
-----------------------------------

             Summary: FlexUnit SequenceCaller prevent function call on non event-dipatcher
object for no reason
                 Key: FLEX-34818
                 URL: https://issues.apache.org/jira/browse/FLEX-34818
             Project: Apache Flex
          Issue Type: Improvement
          Components: FlexUnit
            Reporter: dimitri kara
            Priority: Minor


The Signature of SequenceCaller type the target of the call as IEventDispatcher:
SequenceCaller(target:IEventDispatcher, method:Function, args:Array = null, argsFunction:Function
= null)
But if you look at the source code, you can see that the SequenceCaller only use the target
to call the method on it, without adding any event listener nor using IEventDispatcher method/property
on it. Target could be a non IEventDispatcher objet and everything would work.

But the IEventDispatcher type on the parameter/field prevents us from using the SequenceCaller
on objects that *delegate the event dispatching*, and is a real problem with Robotlegs-like
architecture where Actors (models/services) are not IEventDispatcher but use a common EventDispatcher
object as an event bus.

The assumption was made that you would only use Sequence on IEventDispatcher object, but you
could listen on an EventDispatcher object while making call on another object that with use
the first one to dispatch events.

The fix is simple: the type of the target parameter and _target field should be Object and
not IEventDispatcher. No other modification are needed.

Example of wanted behavior (with FileService not implementing IEventDispatcher):

[Test]
public function TestFileService():void
var service:IFileService=new FileService();
var dispatcher:IEventDispatcher=new EventDispatcher;
service.dispatcher=dispatcher;
 var sequence:SequenceRunner = new SequenceRunner( this );
  sequence.addStep(new  *SequenceCaller*( *service* , lervice.loadDefaultFile));
        sequence.addStep( new SequenceWaiter( *dispatcher* ,FileEvent.LOADED , 100 ) );
...
}





--
This message was sent by Atlassian JIRA
(v6.3.4#6332)

Mime
View raw message