How to use the rx-lite.Subject function in rx-lite

To help you get started, we’ve selected a few rx-lite 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 maciejzasada / flowchat / lib / flowchat.js View on Github external
constructor() {
    const self = this;

    this._inputSubscription = null;
    this.setInput(new Subject());
    this._state = new Subject();
    this._output = new Subject();
    this._activators = [];
    this._paths = [];
    this._reducers = {};
    this._sagas = {};
    this._sagaMiddleware = createSagaMiddleware();
    this._store = createStore(
      (state) => state,
      applyMiddleware(this._sagaMiddleware)
    );

    // Set up internal sagas.

    // Send.
    this._sendSaga = function* sendSaga({ data, sessionId }) {
      yield self._send(data, sessionId);
github SharePoint / sp-dev-fx-webparts / samples / react-rxjs-event-emitter / src / libraries / rxJsEventEmitter / RxJsEventEmitter.ts View on Github external
public emit(name: string, data: Object): void {
    let fnName: string = this._createName(name);

    if (!this.subjects[fnName]) {

      this.subjects[fnName] = new Subject();
    }

    this.subjects[fnName].onNext(data);
  }
github DAVFoundation / dav-js / src / dav.js View on Github external
}
        region.ttl = region.ttl || 120;

        const registerNeedTypeForCaptain = () => axios.post(`${dav.missionControlURL}/captains/${dav.davId}`, { need_type: needType, region })
          .catch((err) => {
            console.error(err);
          });

        registerNeedTypeForCaptain();

        rx.Observable.interval(90000 /*1.5m*/).subscribe(
          registerNeedTypeForCaptain,
          (err) => console.log('Error: ' + err),
          () => console.log(''));

        const observable = new rx.Subject();
        dav.needTypes[needType] = observable;

        observable.update = async () => {
          await axios.put(`${dav.missionControlURL}/captains/${dav.davId}/needs`, { need_type: needType, region });
        };

        return observable;
      }
    };
github DAVFoundation / dav-js / src / dav.js View on Github external
forBid: (bidId, contract) => {
        dav.contracts[bidId] = new rx.Subject;
        contract.dav_id = dav.davId;
        axios.post(`${dav.missionControlURL}/contracts/${bidId}`, contract)
          .catch((err) => {
            console.error(err);
          });
        return dav.contracts[bidId];
      }
    };
github nicksrandall / inquirer-directory / index.js View on Github external
var searchTerm = keySlash.flatMap(function (md) {
    self.searchMode = true;
    self.searchTerm = '';
    self.render();
    var end$ = new rx.Subject();
    var done$ = rx.Observable.merge(events.line, end$);
    return alphaNumeric.map(function (e) {
      if (e.key.name === 'backspace' && self.searchTerm.length) {
        self.searchTerm = self.searchTerm.slice(0, -1);
      } else if (e.value) {
        self.searchTerm += e.value;
      }
      if (self.searchTerm === '') {
        end$.onNext(true);
      }
      return self.searchTerm;
    })
    .takeUntil(done$)
    .doOnCompleted(function() {
      self.searchMode = false;
      self.render();
github zjhmale / vscode-idris / src / idris / model.js View on Github external
build(ipkgFile) {
    this.idrisBuildSubject = new Rx.Subject
    this.idrisBuild(this.compilerOptions, ipkgFile)
    return this.idrisBuildSubject
  }
github zjhmale / vscode-idris / src / idris / model.js View on Github external
prepareCommand(cmd) {
    let id = this.getUID()
    let subject = new Rx.Subject
    this.subjects[id] = subject
    this.warnings[id] = []
    this.ideMode(this.compilerOptions).send([cmd, id])
    return subject
  }
github SharePoint / sp-dev-fx-webparts / samples / react-rxjs-event-emitter / src / libraries / rxJsEventEmitter / RxJsEventEmitter.ts View on Github external
public on(name: string, handler: any): void {
    let fnName: string = this._createName(name);

    if (!this.subjects[fnName]) {

      this.subjects[fnName] = new Subject();
    }

    this.subjects[fnName].subscribe(handler);
  }