Giter Site home page Giter Site logo

Comments (4)

iamgodot avatar iamgodot commented on June 11, 2024 1

I tried to say that this is a dynamic name interpolated with the event name.

For each action type you have a generic one, and other that is based or in the event name or in the state name.

For example, given that you have an event named finish and and state completed, something like this finish = pending.to(completed).

You can implement generic or named actions:

  1. on_transition (generic that will be called every time any transition occurs)
  2. on_finish (the on_<event> just for the finish event)
  3. on_enter_state (generic that will be called every time any state is entered)
  4. on_enter_completed ( the on_enter_<state.id> just for the completed state).

Totally, thanks for the explanation. And I suppose it's better to use on_<event>() instead of on_execute_<event>, just like here, to keep things consistently. Let me know if you want this small update on the doc.

from python-statemachine.

fgmacedo avatar fgmacedo commented on June 11, 2024

I tried to say that this is a dynamic name interpolated with the event name.

For each action type you have a generic one, and other that is based or in the event name or in the state name.

For example, given that you have an event named finish and and state completed, something like this finish = pending.to(completed).

You can implement generic or named actions:

  1. on_transition (generic that will be called every time any transition occurs)
  2. on_finish (the on_<event> just for the finish event)
  3. on_enter_state (generic that will be called every time any state is entered)
  4. on_enter_completed ( the on_enter_<state.id> just for the completed state).

from python-statemachine.

fgmacedo avatar fgmacedo commented on June 11, 2024

Oh, now I see 😃, it is a typo. Yes, thanks!

from python-statemachine.

iamgodot avatar iamgodot commented on June 11, 2024

Oh, now I see 😃, it is a typo. Yes, thanks!

You're welcome :)

from python-statemachine.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.