transition all - me

13 views
Skip to first unread message

Chris G

unread,
Mar 23, 2011, 7:19:50 PM3/23/11
to PluginAWeek: Talk
Is there an equivalent of:

transition all-[self]

So transitions occur for all states except the one I'm in? (to save
the unnecessary update and other hooks firing)

Thanks,

Chris

Chris G

unread,
Mar 24, 2011, 12:30:44 PM3/24/11
to PluginAWeek: Talk
Another way of asking that question is: can I call events and have
them be ignored if the state wouldn't change? Instead of wrapping
code with a bunch of "unless [state is already :this]"

Thanks,
/c

Solomon White

unread,
Mar 24, 2011, 1:14:42 PM3/24/11
to pluginaw...@googlegroups.com
Chris--

I think you can accomplish that a couple of ways:

(warning, untested code ahead)

event :cancel do
  transition all - [:cancelled] => :cancelled
end

or

event :cancel do
  transition all => :cancelled, :unless => :cancelled?
end
  


--
You received this message because you are subscribed to the Google Groups "PluginAWeek: Talk" group.
To post to this group, send email to pluginaw...@googlegroups.com.
To unsubscribe from this group, send email to pluginaweek-ta...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pluginaweek-talk?hl=en.


Chris G

unread,
Mar 24, 2011, 2:58:05 PM3/24/11
to PluginAWeek: Talk
Hi Solomon,

I previously tried the first, and the second works equally well (good
tip).

I guess my mistake was in using ! notation for state changes (that the
code then forbade).

Thanks!
/c
Reply all
Reply to author
Forward
0 new messages