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

Make RunnableTask easier to use #41

Closed
KenSuenobu opened this issue May 19, 2018 · 2 comments
Closed

Make RunnableTask easier to use #41

KenSuenobu opened this issue May 19, 2018 · 2 comments
Labels
improvement Make something better than it was
Milestone

Comments

@KenSuenobu
Copy link
Owner

Instead of using the notation:

    JobBuilder()
        .withTask(new MyTask() with RunnableTask)

I would like to use:

    JobBuilder()
        .withTask(RunnableTask(new MyTask()))

or something a'la Monix Task:

    JobBuilder()
        .withTask(RunnableTask { ... code here })
@KenSuenobu KenSuenobu added the improvement Make something better than it was label May 19, 2018
@KenSuenobu KenSuenobu added this to the 0.0.2 milestone May 19, 2018
@KenSuenobu
Copy link
Owner Author

Option #2 is already available; Option #1 allows you to wrap the class with a RunnableTask trait, while maintaining access to its member methods and variables. Option #3 is fairly limiting, as it's simply elegance for writing a RunnableTask with some defaults, and a wrapped run() method within a block.

@KenSuenobu KenSuenobu modified the milestones: 0.0.2, 0.0.3 May 20, 2018
@KenSuenobu
Copy link
Owner Author

This has changed slightly. It's not a RunnableTask that has the ability to create a simple task - it's Task.

You can now do:

    val task1: Task = Task {
        // Do task code here
        // Do some more task code here
    }

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
improvement Make something better than it was
Projects
None yet
Development

No branches or pull requests

1 participant