Skip to content

Can't use event handler by itself #28

Closed
@joslinm

Description

@joslinm

Why can't I use the event handler by itself without adding a route? Shouldn't this be a design decision up to the client programmer?

machine.addEventHandler(.GotoPreviousCard, handler: { (event, transition, order, userInfo) -> Void in
  println("FeedView ! GotoPreviousCard")
})

Instead, I have to add a route that messes everything up. Sure, I can make it work but it's pretty pointless when I don't want to change states and instead I have code firing twice I would rather not be.

I would like my view to react to events without making state changes. If anything, I would rather filter events for certain states. For example, if someone "likes" a picture, you might send a Like event during the ShowingPhoto state. Your library could make the validation and what not.

In lieu of this functionality, I made transitions with nil => nil

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions