All Downloads are FREE. Search and download functionalities are using the official Maven repository.

fr.lteconsulting.angular2gwt.client.interop.angular.rxjs.Observable Maven / Gradle / Ivy

There is a newer version: 1.8
Show newest version
package fr.lteconsulting.angular2gwt.client.interop.angular.rxjs;

import fr.lteconsulting.angular2gwt.client.JsArray;
import fr.lteconsulting.angular2gwt.client.interop.promise.Promise;
import jsinterop.annotations.JsFunction;
import jsinterop.annotations.JsMethod;
import jsinterop.annotations.JsType;

@JsType( isNative = true, namespace = "ng.rxjs", name = "Observable" )
public class Observable
{
	public native void forEach( ForEachCallback callback );

	@JsFunction
	@FunctionalInterface
	public interface ForEachCallback
	{
		void execute( T value );
	}

	public native Subscription subscribe( Observer observer );

	public native  Observable map( MapFunction mapFunction );

	public native Promise toPromise();

	public native Observable debounceTime( int time );

	public native Observable distinctUntilChanged();

	public native Observable distinctUntilChanged( KeySelector keySelector );

	public native  Observable distinctUntilChanged( KeySelector keySelector, KeyComparator keyComparator );

	@JsMethod( namespace = "ng.rxjs.Observable", name = "of" )
	public static native  Observable> of( JsArray elements );

	@JsFunction
	@FunctionalInterface
	public interface KeySelector
	{
		O selectKey( T item );
	}

	@JsFunction
	@FunctionalInterface
	public interface KeyComparator
	{
		boolean selectKey( O a, O b );
	}

	public native  Observable switchMap( Projection projection );

	public native  Observable switchMap( Projection projection, ResultSelector resultSelector );

	@JsFunction
	@FunctionalInterface
	public interface Projection
	{
		Observable project( T item, int index );
	}

	@JsFunction
	@FunctionalInterface
	public interface ResultSelector
	{
		R selectResult( T outerValue, I innerValue, int outerIndex, int innerIndex );
	}

	@JsMethod( name = "catch" )
	public native Observable onError( ErrorCatcher errorCatcher );

	@JsFunction
	@FunctionalInterface
	public interface ErrorCatcher
	{
		Observable catchError( Object error );
	}
}