Skip to content

Add paused-init feature. #17

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

Merged
merged 1 commit into from
Dec 20, 2014
Merged

Add paused-init feature. #17

merged 1 commit into from
Dec 20, 2014

Conversation

inamiy
Copy link
Member

@inamiy inamiy commented Dec 20, 2014

This pull request will enable Task to pause its execution on init(),
and manually resume() to start running (like NSURLSessionTask).

This feature will be useful in ReactKit for creating "cold signal" as well.

Usage

// define task
let task = Task(paused: true) { progress, fulfill, reject, configure in
    ... // this closure will be invoked on 1st `resume()`
}

// task.state is `.Paused` at this point

task.resume()    // start running

inamiy added a commit that referenced this pull request Dec 20, 2014
@inamiy inamiy merged commit e82a704 into master Dec 20, 2014
@inamiy inamiy deleted the paused-init branch December 20, 2014 01:32
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.

1 participant