Making a helper function for more complex task manipulation #67
philj404
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Usually I like the basic timer
in(...)
/at(...)
/every(...)
primitive methods. I think they are easy to understand and use correctly.But... some people might have more complex task creation requirements than these primitives provide. This can be a serious issue if your application has many task instances which each need the same set of startup behaviors -- it would be best to make this shared code rather than trying to maintain copy-pasted code.
Here is an example helper function which has a slightly more complex task startup than the
in(...)
/at(...)
/every(...)
primitives can provide.In this case we want the task to start immediately -- not have an extra delay at startup.
You could use a helper like this to provide the customized startup behavior on multiple tasks. If you need more customization, just add more input arguments.
Here is a sketch which uses this helper:
Beta Was this translation helpful? Give feedback.
All reactions