How to use the @reactivex/rxjs.Subject function in @reactivex/rxjs

To help you get started, we’ve selected a few @reactivex/rxjs examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github wzr1337 / rsi.server / src / main.ts View on Github external
import { Observable, Subject } from '@reactivex/rxjs';

// set up the server


// register an Object
var mySubject = new Subject();
var subscription = mySubject.subscribe(
  (x:any) => {
    console.log('Next: ' + x);
  },
  (err:any) => {
    console.log('Error: ' + err);
  },
  () => {
    console.log('Completed');
  });


// push info into the Object

mySubject.next('foo');
github giltig / rxfrf / src / shared / dispatcher / dispatcher.js View on Github external
import { Subject } from '@reactivex/rxjs'
import { Actions } from 'shared/actions'

const _dispatcher = new Subject()

// Hide the subject, so the outer world doesn't abuse it
const dispatcher =
  _dispatcher
    .asObservable()
    .publishReplay(1)
    .refCount()

export const DONT_USE_UNLESS_YOUR_NAME_IS_ACTION_CREATOR = _dispatcher

function buildFilterFunction (args) {
  // Check if has actions
  const hasActions =
    Object.keys(args)
      .some(key => Object.keys(Actions).indexOf(args[key]) !== -1)
github microsoft / BotFramework-WebChat / built / ConsoleView.js View on Github external
"use strict";
var __extends = (this && this.__extends) || function (d, b) {
    for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p];
    function __() { this.constructor = d; }
    d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
var React = require('react');
var ConsoleProvider_1 = require('./ConsoleProvider');
var rxjs_1 = require('@reactivex/rxjs');
var Store_1 = require('./Store');
var console$ = new rxjs_1.Subject();
var ConsoleProvider = (function () {
    function ConsoleProvider() {
        var _this = this;
        this.add = function (severity, message) {
            var args = [];
            for (var _i = 2; _i < arguments.length; _i++) {
                args[_i - 2] = arguments[_i];
            }
            var entry = { severity: severity, message: message, args: args };
            console$.next(entry);
            console.log.apply(console, [message].concat(args));
        };
        this.log = function (message) {
            var args = [];
            for (var _i = 1; _i < arguments.length; _i++) {
                args[_i - 1] = arguments[_i];
github microsoft / BotFramework-WebChat / src / ConsoleView.tsx View on Github external
import * as React from 'react';
import { Reducer } from 'redux';
import { Severity, IConsoleEntry, IConsoleProvider } from './ConsoleProvider';
import { Subscription, Observable, Subject } from '@reactivex/rxjs';
import { getStore, getState, ConsoleAction } from './Store';


var console$ = new Subject();

export class ConsoleProvider implements IConsoleProvider {
    add = (severity: Severity, message: any, ...args: any[]) => {
        let entry: IConsoleEntry = { severity, message, args };
        console$.next(entry);
        console.log(message, ...args);
    }
    log = (message: any, ...args: any[]) => {
        this.add(Severity.info, message, ...args);
    }
    info = (message: any, ...args: any[]) => {
        this.add(Severity.info, message, ...args);
    }
    trace = (message: any, ...args: any[]) => {
        this.add(Severity.trace, message, ...args);
    }
github pragyandas / WeatherApp / weather.js View on Github external
function Weather() {
        var _this = this;
        this.weatherDataSubject = new Rx.Subject();
        this.weatherDetailSubject = new Rx.Subject();
        this.weatherForcastSubject = new Rx.Subject();
        this.getWeatherDetails = function (city) {
            _this.firebase.child('/' + city + '/currently').on("value", function (result) {
                _this.weatherDetailSubject.next(result.val());
            });
            _this.firebase.child('/' + city + '/daily/data').on("value", function (result) {
                _this.weatherForcastSubject.next(result.val());
            });
        };
        this.firebase = new Firebase('https://publicdata-weather.firebaseio.com');
        this.firebase.on("value", function (result) {
            _this.weatherDataSubject.next(result.val());
        });
    }
    return Weather;
github czcorpus / kontext / public / files / js / app / dispatcher.ts View on Github external
constructor() {
            this.inStream$ = new Rx.Subject();
            this.action$ = this.inStream$.flatMap(v => {
                if (v instanceof Rx.Observable) {
                    return v;

                } else {
                    return Rx.Observable.from([v]);
                }
            }).share();
            this.dispatch = this.dispatch.bind(this);
        }
github krakenjs / react-redux-krakenjs-swaggerize-express / client / app / components / pet_form / form.js View on Github external
constructor(props) {
        super(props);
        this.state = {};
        this.urls = new Subject();
        this.photoUrlChange = this.photoUrlChange.bind(this);
        this.nameChange = this.nameChange.bind(this);
        this.formSubmit = this.formSubmit.bind(this);
    }
github pragyandas / WeatherApp / weather.js View on Github external
function Weather() {
        var _this = this;
        this.weatherDataSubject = new Rx.Subject();
        this.weatherDetailSubject = new Rx.Subject();
        this.weatherForcastSubject = new Rx.Subject();
        this.getWeatherDetails = function (city) {
            _this.firebase.child('/' + city + '/currently').on("value", function (result) {
                _this.weatherDetailSubject.next(result.val());
            });
            _this.firebase.child('/' + city + '/daily/data').on("value", function (result) {
                _this.weatherForcastSubject.next(result.val());
            });
        };
        this.firebase = new Firebase('https://publicdata-weather.firebaseio.com');
        this.firebase.on("value", function (result) {
            _this.weatherDataSubject.next(result.val());
        });
    }
    return Weather;
github microsoft / BotFramework-WebChat / built / Chat.js View on Github external
function Chat(props) {
        var _this = _super.call(this, props) || this;
        _this.store = Store_1.createStore();
        _this.typingActivity$ = new rxjs_1.Subject();
        exports.konsole.log("BotChat.Chat props", props);
        if (props.formatOptions)
            _this.store.dispatch({ type: 'Set_Format_Options', options: props.formatOptions });
        _this.store.dispatch({ type: 'Set_Localized_Strings', strings: Strings_1.strings(props.locale || window.navigator.language) });
        return _this;
    }
    Chat.prototype.handleIncomingActivity = function (activity) {
github pragyandas / WeatherApp / weather.js View on Github external
function Weather() {
        var _this = this;
        this.weatherDataSubject = new Rx.Subject();
        this.weatherDetailSubject = new Rx.Subject();
        this.weatherForcastSubject = new Rx.Subject();
        this.getWeatherDetails = function (city) {
            _this.firebase.child('/' + city + '/currently').on("value", function (result) {
                _this.weatherDetailSubject.next(result.val());
            });
            _this.firebase.child('/' + city + '/daily/data').on("value", function (result) {
                _this.weatherForcastSubject.next(result.val());
            });
        };
        this.firebase = new Firebase('https://publicdata-weather.firebaseio.com');
        this.firebase.on("value", function (result) {
            _this.weatherDataSubject.next(result.val());
        });
    }
    return Weather;