How to use the kefir.fromPromise function in kefir

To help you get started, we’ve selected a few kefir 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 intraxia / wp-gistpen / commands / E2ECommand.tsx View on Github external
const toObs = (ret: E2EExec): Observable => {
  // Normalize other values to Observables.
  if (ret == null) {
    return Kefir.constant('');
  }

  if (isPromise(ret)) {
    return Kefir.fromPromise(ret);
  }

  return ret;
};
github codefresh-io / zenkube / log_capture / src / capture.js View on Github external
const
    _ = require('lodash'),
    fs = require('fs'),
    path = require('path'),
    util = require('util'),
    kefir = require('kefir'),
    Kubemote = require('kubemotelib');

let
    client = new Kubemote(Kubemote.CONFIGURATION_FILE()),
    outputFile = fs.createWriteStream('dump.jsonl');   // .jsonl is a valid extension for "json lines" file (not valid JSON)

let deploymentEventStream = kefir
    .fromPromise(client.watchDeploymentList())
    .flatMap(()=> kefir.fromEvents(client, 'watch'))        //"ADDED", "MODIFIED", "DELETED", "ERROR"
    .onValue((event)=> {
        let payload = { timestamp: Date.now(), event };
        outputFile.write([JSON.stringify(payload), "\n"].join(''));
    });
github researchspace / researchspace / metaphactory / web / src / main / components / 3-rd-party / ontodia / Ontodia.ts View on Github external
endpointUrl: '',
        prepareImages: !imageQuery ? undefined : elementsInfo => {
          return prepareImages(elementsInfo, imageQuery);
        },
        imagePropertyUris: imageIris,
        // should we specify it in config?
        // GET allows for more caching, but does not run well with huge data sets
        queryMethod: SparqlQueryMethod.POST,
        acceptBlankNodes: true,
      };
      const repositories = this.getRepositories();
      const createRDFStorage = provisionQuery !== undefined;
      this.dataProvider = config.getDataProvider(options, repositories, createRDFStorage);

      this.cancellation.map(Kefir.combine([
        Kefir.fromPromise(this.setLayout()),
        this.parsedMetadata,
      ])).observe({
        error: configurationError => this.setState({configurationError}),
      });
    }
  }
github ivan-kleshnin / unredux / vendors / framework / index.js View on Github external
.flatMapLatest(url => {
        if (D.isBrowser) {
          window.history.pushState({}, "", url)
        }
        let routeResult = router.doroute(url)
        return K.fromPromise(routeResult.payload().then(app => {
          return {...routeResult, app, url}
        }))
      })
      .map(({mask, params, app, url}) => {
github irskep / summertunes / client / src / model / browsingModel.js View on Github external
.flatMapLatest(([beetsWebURL, artist, album]) => {
    return K.fromPromise(getTrackList(beetsWebURL, album, artist));
  })
  .toProperty(() => []);
github developmentseed / planet-stream / lib / streams / MetaStream.js View on Github external
var parsedData = urlStrings.flatMap(function (x) {
    return K.fromPromise(request({encoding: null, uri: x}));
  })
        .map(zlib.unzipSync)
github ivan-kleshnin / unredux / examples / 7.1.crud / client / user-detail / index.js View on Github external
    .flatMapConcat(_ => K
      .fromPromise(A.get(`/api/users/${params.id}/`))
      .map(resp => resp.data.models[params.id])
    )
github intraxia / wp-gistpen / client / components / Editor / instance / Code.js View on Github external
const createPrismUpdateStream = (props: Props): Observable =>
    Kefir.fromPromise(Promise.all([
        Prism.setTheme(props.theme),
        Prism.togglePlugin('show-invisibles', props.invisibles === 'on')
    ]))
        .ignoreValues()
        .setName('prismUpdate$');
github ivan-kleshnin / unredux / examples / 7.1.crud / client / post-edit / index.js View on Github external
    }).flatMapConcat(form => K
      .fromPromise(A.put(`/api/posts/${params.id}/`, form))
      .map(resp => resp.data.model)
    )

kefir

Reactive Programming library for JavaScript inspired by Bacon.js and RxJS with focus on high performance and low memory usage

MIT
Latest version published 4 years ago

Package Health Score

57 / 100
Full package analysis