Skip to content
<!DOCTYPE html>
<html>
<head>
<meta http-equiv='Content-type' content='text/html; charset=utf-8'>
<title>Basic Example with JSX</title>
<link rel="stylesheet" href="base.css" />
</head>
<body>
<h1>ReactJs + RxJs</h1>
<div id="container">
View leveldb-acl.js
var Rx = require('rx');
var _ = require('lodash');
function noop() { }
function makeArray(item) {
return Array.isArray(item) ? item : [item];
}
var LevelUpAdapter = {
View run-mocha.js
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.
View pouchdb.js
/**
* PouchDB backend
*/
"use strict";
var async = require('async');
var _ = require('lodash');
/**
* Creates a PouchDB Backend
View assign.js
Observable.prototype.assign = function (object, property) {
return this.subscribe(function (x) {
object[property] = value;
});
};
// Usage
Observable.range(1, 1000)
.assign(document.querySelector('#result'), 'textContent');
View iterator.ts
interface Iterable<T> {
[Symbol.iterator]() : Iterator<T>
}
interface Iterator<T> {
[Symbol.iterator]() : Iterator<T>
next() : IteratorResult<T>
}
interface IteratorResult<T> {
View rx.js
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
};
View totask.cs
/// <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)
View foo.cs
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);
View mapping-subject.js
// 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);});
Something went wrong with that request. Please try again.