PDA

View Full Version : History - complex events



4dept
4 Jun 2009, 9:37 PM
Some events in my app can be "complex", i.e. containing from some "simple events" fired one after another. For example, complex events can be: "navingation necessary page" and "data request there". If both events has it's own history token, clicking "Back" button will fire only one previous event, not both events.

Every "simple event" from this "complex event" can be used separately and should be fired with History token.

Code example:


// navigation facade
public class NavigateFacade {
// "simple event"
public static void navigateRequestPage() {
Dispatcher.dispatch(appEvents.REQUEST_PAGE, /* ...*/);
}

public static void navigateAboutPage() {
Dispatcher.dispatch(appEvents.ABOUT_PAGE, /* ...*/);
}
}

// data request facade (on requestPageToken)
public class RequestFacade {

// "simple event"
public static void request(int id) {
Dispatcher.dispatch(appEvents.REQUEST, /* ... */);
}
}

public class AppFacade {
// "complex event"
public static void request(id) {
NavigateFacade.navigateRequestPage();
RequestFacade.request(id);
}

pubic static void about() {
NavigateFacade.navigateAboutPage();
}
}

now what is the sutiation:


AppFacade.request(id);
AppFacade.about();
// "back" click
clicking "Back" will fire only last "simple event" from "complex event": RequestFacade.request(id) but logically should fire both from AppFacade.request(id)