0.4.2
Creates a new Observable
(Function)
const obs$ = new Observable((observer) => {
for (let i = 0; i < 10; ++i) {
observer.next(i);
}
observer.complete();
});
const obs$ = Observable.create((observer) => {
for (let i = 0; i < 10; ++i) {
observer.next(i);
}
observer.complete();
});
(Function)
Observable
:
Subscribe to an observable stream
(null
= noop
)
(null
= noop
)
Subscription
:
observable$.subscribe({
next(value) {
console.log('logs if next', value);
},
error() {
console.log('logs if error');
},
complete() {
console.log('logs if complete');
}
});
Subscription
:
observable$.subscribe(
(value) => console.log('logs if next', value),
() => console.log('logs if error'),
() => console.log('logs if complete')
);
Make a cancellable XHR request
(string)
(Object
= {}
)
Name | Description |
---|---|
$1.method any
(default 'GET' )
|
|
$1.requestData any
(default '' )
|
|
$1.headers any
(default [] )
|
(string?)
(any?)
Observable
:
Will create an observable that will listen for an event on a DOM element
Utilizes the makeHot
method so that the event does not get reattached on every subscription
Observable
:
Turns a promise into an observable that emits the value of the promise and then completes
(Promise)
Observable
:
Creates an interval that will count on every interval tick
(Number)
in milliseconds to output the interval count
(Number?
= 0
)
number to start the interval count at
Observable
:
Takes any number of arguments and outputs them in order in an Observable stream
(Array<any>)
Observable
:
Output a range of numbers to an Observable stream
Observable
:
Takes an average of everything coming into the event stream until it completes
(Observable)
Observable
:
combines multiple observables at the same time. it will only call the observer's next function when all observables have emitted at least one value
(Array<Observable>)
(Function
= argsCallback
)
Observable
:
Concatenate any number of observables together
Observable
:
Counts the number of values coming into the stream on complete
(Observable)
(Function?
= value=>true
)
a function to use to filter out values that you do not wish to count
Observable
:
Debounces values that will be sent down the stream. Will only output values if there has not been any new values in the past time interval passed
(Observable)
(Number)
amount of time in milliseconds
Observable
:
Will delay output from the observable until a specific time interval has passed
(Observable)
(Number)
amount of time in milliseconds
Observable
:
Will run some callback before passing the current value to the subscription
(Observable)
(Function)
Observable
:
doStuff(obs$, (value) => console.log(value))
.subscribe((sameValue) => console.log('Will log the same value: ', sameValue))l
Will filter out values that you do not want to subscribe to
(Observable)
(Function)
Observable
:
Will take the first value from the observable and then complete
This is an alias for take(obs$, 1, callback)
(Observable)
(Function?)
filter out values before taking the first one
Same as map(obs$, mapCallback)
but will take the value of the callback and turn it from an observable to a value
(Observable)
(Function)
Observable
:
Will map each value to a new value using the callback
(Observable)
(Function)
Observable
:
Will result in the maximum value passed to the observer then will complete
(Observable)
Observable
:
Will merge any number of observables into one observable stream
(Array<Observable>)
Observable
:
Will result in the minimum value passed to the observer then will complete
(any)
Observable
:
Sort of the same way that Array.reduce works, it will concatenate all of the values passing through an Observable event stream with a given scanCallback
Observable
:
Observable
:
Sums all the values of an observable upon completion
(Observable)
The value from the mapCallback is an observable and if another value comes through the previous observable is cancelled
This is useful for things like typeaheads where you dont want a request for every keypress
(Observable)
(Function)
Observable
:
Takes a number of values that satisfy the filterCallback
then completes
Observable
:
Takes values from the source$
until the takeSource$
emits one value
(Observable)
(Observable)
Observable
:
Reverse of fromPromise
Converts an Observable to a promise, takes the first value and then completes
(Observable)
Promise<any>
:
(Observable)
(Function
= argsCallback
)
Observable
:
Makes an observable "hot" -- very useful for things like DOM event listeners so that the events do not get bound numerous amounts of times
(Observable)
Observable
: