How to use the rx.Observable.just function in rx

To help you get started, we’ve selected a few rx 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 freeCodeCamp / freeCodeCamp / common / app / routes / Hikes / redux / oldActions.js View on Github external
}
      };

      const removeShake = {
        transform(state) {
          return {
            ...state,
            hikesApp: {
              ...state.hikesApp,
              shake: false
            }
          };
        }
      };

      return Observable
        .just(removeShake)
        .delay(500)
        .startWith(startShake);
    }

    // move to next question
    // index 0
    if (tests[currentQuestion]) {

      return Observable.just({
        transform(state) {
          const hikesApp = {
            ...state.hikesApp,
            mouse: [0, 0]
          };
          return { ...state, hikesApp };
github laszlokorte / tams-tools / app / components / logic / input-field / index.js View on Github external
export default ({
  DOM, // DOM driver source
  globalEvents, // globalEvent driver sources
  input$ = O.just({ // The text initial value of the input field
    langId: "auto", // The selected language
    term: "", // The value of the text field
  }),
  props$ = O.just({
    showCompletion: true, // if buttons for inserting syntax tokens
                          // should be shown above the text field
  }),
}) => {
  const actions = intent({
    DOM,
    globalEvents,
  });

  const state$ = model(props$, input$, actions);
  const vtree$ = view(state$);
github tsers-js / core / test / execute.js View on Github external
it("executes the output signals by driver name and discards additional signals", done => {
    const s = new Rx.Subject()
    const check = expected => out$ => out$.subscribe(actual => {
      actual.should.equal(expected)
      s.onNext()
    })

    const [{compose}, _, E] = TSERS({
      A: driver(check("a")),
      B: driver(check("b")),
      C: driver(undefined)
    })

    const out$ = compose({A: O.just("a"), B: O.just("b"), D: O.just("d")})
    s.bufferWithCount(2).subscribe(() => done())
    E(out$)
  })
github goodmind / cycle-telegram / test / integration / index / rx.ts View on Github external
let main = () => ({
    bot: $.from([
      $.just(getUserProfilePhotos(
        { user_id: 39759851 },
        {}))
    ])
  })
  let { sources, run } = Cycle(main, { bot: basicDriver })
github tsers-js / core / test / tsers.js View on Github external
function main() {
      return mux({A: O.just("a"), B: O.just("b"), D: O.just("d")})
    }
github goodmind / cycle-telegram / test / integration / index / rx.ts View on Github external
let main = () => ({
    bot: $.from([
      $.just(getFile(
        { file_id: FILE_ID },
        {}))
    ])
  })
  let { sources, run } = Cycle(main, { bot: basicDriver })
github freeCodeCamp / freeCodeCamp / common / app / utils / render-to-string.js View on Github external
export function fetch({ fetchContext = [] }) {
  if (fetchContext.length === 0) {
    log('empty fetch context found');
    return Observable.just(fetchContext);
  }
  return Observable.from(fetchContext, null, null, Scheduler.default)
    .doOnNext(({ name }) => log(`calling ${name} action creator`))
    .map(({ action, actionArgs }) => action.apply(null, actionArgs))
    .doOnNext(fetch$ => {
      if (!Observable.isObservable(fetch$)) {
        throw new Error(
          'action creator should return an observable'
        );
      }
    })
    .map(fetch$ => fetch$.doOnNext(action => log('action', action.type)))
    .mergeAll()
    .doOnCompleted(() => log('all fetch observables completed'));
}
github dhis2 / d2-ui / src / auto-complete / AutoComplete.component.js View on Github external
function searchByForModel(searchBy, modelTypeToSearch, valueToSearchFor, options = {}) {
    if (!Boolean(modelTypeToSearch) || !Boolean(valueToSearchFor)) {
        log.warn('forType property and value should be provided to be able to show results');

        return Observable.just([]);
    }

    const searchQueryRequest = d2Lib.getInstance()
        .then(d2 => d2.models[modelTypeToSearch])
        .then(modelType => modelType.filter().on(searchBy).ilike(valueToSearchFor))
        .then(modelTypeWithFilter => modelTypeWithFilter.list(options))
        .then(collection => collection.toArray())
        .catch(error => log.error(error));

    return Observable.fromPromise(searchQueryRequest);
}
github Cmdv / cycle-natural-language-search / src / client / app.js View on Github external
function main(sources) {

  const {DOM, HTTP, router} = searchBar(sources);

  const Content = ContentRouter(sources, Res);
  //const {state$} = Content;

  const searchBarDOM$ = DOM

  const view$ = Observable.just(
    view(
      searchBarDOM$,
      Content.DOM
    )
  );

  return {
    DOM: view$,
    router: router.startWith('/'),
    //state$: state$.startWith({counter: 0}),
    HTTP: HTTP
  }
};