Created
May 14, 2013 16:04
-
-
Save benjchristensen/5577144 to your computer and use it in GitHub Desktop.
Interfaces of Rx
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Observable<T> { | |
public Subscription subscribe(Observer<T> observer); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Observer<T> { | |
/** | |
* Notifies the Observer that the {@link Observable} has finished sending push-based notifications. | |
* <p> | |
* The {@link Observable} will not call this closure if it calls <code>onError</code>. | |
*/ | |
public void onCompleted(); | |
/** | |
* Notifies the Observer that the {@link Observable} has experienced an error condition. | |
* <p> | |
* If the {@link Observable} calls this closure, it will not thereafter call <code>onNext</code> or <code>onCompleted</code>. | |
* | |
* @param e | |
*/ | |
public void onError(Exception e); | |
/** | |
* Provides the Observer with new data. | |
* <p> | |
* The {@link Observable} calls this closure 1 or more times, unless it calls <code>onError</code> in which case this closure may never be called. | |
* <p> | |
* The {@link Observable} will not call this closure again after it calls either <code>onCompleted</code> or <code>onError</code>. | |
* | |
* @param args | |
*/ | |
public void onNext(T args); | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface Subscription { | |
/** | |
* Stop receiving notifications on the {@link Observer} that was registered when this Subscription was received. | |
* <p> | |
* This allows unregistering an {@link Observer} before it has finished receiving all events (ie. before onCompleted is called). | |
*/ | |
public void unsubscribe(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment