Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a payload to dispatch events and state changes #9

Open
wants to merge 6 commits into
base: master
Choose a base branch
from

Conversation

GrahO23
Copy link

@GrahO23 GrahO23 commented Jan 20, 2015

Hi,

I love YBStatechart, I've had a go at adding payloads to the dispatch and state changes to help avoid storing unnecessary variable outside the state chart.

At least I find it useful for passing params and data between states and transitions.

Don't know if you are interested for master.

Cheers

Graham

@ronaldmannak
Copy link
Owner

Very cool, thanks! What is the rationale behind making the payload parameter mandatory, instead of optional by having two methods (one with a payload parameter, one without).

cc @martijnthe

@GrahO23
Copy link
Author

GrahO23 commented Jan 22, 2015

Hi Ronald thanks.
All the methods with payloads are overloads and all the original calls are still there ( or should be :) )

  • (void)dispatchEvent:(NSString*)event;
  • (void)dispatchEvent:(NSString*)event withPayload:(id)payLoad;
  • (void)activateStateWithName:(NSString*)stateName;
  • (void)activateStateWithName:(NSString*)stateName withPayload:(id)payload;
  • (void)activateStateWithName:(NSString*)stateName saveToHistory:(BOOL)saveToHistory;
  • (void)activateStateWithName:(NSString*)stateName saveToHistory:(BOOL)saveToHistory withPayload:(id)payload;
  • (void)activateState:(YBState*)state;
  • (void)activateState:(YBState_)state *_withPayload:(id)payload;
  • (void)activateState:(YBState*)state saveToHistory:(BOOL)saveToHistory;
  • (void)activateState:(YBState*)state saveToHistory:(BOOL)saveToHistory withPayload:(id)payload;

/Graham

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants