Skip to content
var Mocha = require('mocha'),
fs = require('fs'),
path = require('path');
// First, you need to instantiate a Mocha instance.
var mocha = new Mocha;
// Then, you need to use the method "addFile" on the mocha
// object for each file.
/**
* PouchDB backend
*/
"use strict";
var async = require('async');
var _ = require('lodash');
/**
* Creates a PouchDB Backend
Observable.prototype.assign = function (object, property) {
return this.subscribe(function (x) {
object[property] = value;
});
};
// Usage
Observable.range(1, 1000)
.assign(document.querySelector('#result'), 'textContent');
interface Iterable<T> {
[Symbol.iterator]() : Iterator<T>
}
interface Iterator<T> {
[Symbol.iterator]() : Iterator<T>
next() : IteratorResult<T>
}
interface IteratorResult<T> {
var Observable = require('rx.observable');
var map = require('rx.observable.map');
Observable.prototype.map = function (selector, thisArg) {
return map(this, selector, thisArg);
}
module.exports = {
Observable: Observable
};
/// <summary>
/// Returns a task that will receive the last value or the exception produced by the observable sequence.
/// </summary>
/// <typeparam name="TResult">The type of the elements in the source sequence.</typeparam>
/// <param name="observable">Observable sequence to convert to a task.</param>
/// <param name="cancellationToken">Cancellation token that can be used to cancel the task, causing unsubscription from the observable sequence.</param>
/// <param name="state">The state to use as the underlying task's AsyncState.</param>
/// <returns>A task that will receive the last element or the exception produced by the observable sequence.</returns>
/// <exception cref="ArgumentNullException"><paramref name="observable"/> is null.</exception>
public static Task<IEnumerable<TResult>> ToTask<TResult>(this IObservable<TResult> observable, CancellationToken cancellationToken, object state)
Enumerable.Range(1, 4).ToObservable()
.GroupBy(x => x % 3)
.Concat()
.Subscribe(Console.WriteLine);
// => 1
// => 4
Enumerable.Range(1, 4).ToObservable()
.GroupBy(x => x % 3)
.Merge()
.Subscribe(Console.WriteLine);
// Create a single subject for all emitting of data
var subject = new Rx.Subject();
// Create something just for mapping
var obs = subject.map(function(message) {
return message + ' dawg.';
});
// Subscribe to that
obs.subscribe(function(message) {console.log(message);});
interface Disposable {
dispose(): void
}
interface AsyncObservable<T> {
subscribe(observer: AsyncObserver<T>) : Disposable
// OR
forEach(observer: AsyncObserver<T>) : Disposable
}
interface Disposable {
dispose(): void
}
interface Observable<T> {
subscribe(observer: Observer<T>) : Disposable
// OR
forEach(observer: Observer<T>) : Disposable
}
Something went wrong with that request. Please try again.