How to use the kefir.never 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 ivan-kleshnin / unredux / examples / 7.1.crud / client / post-create / index.js View on Github external
}).flatMapErrors(err => {
      console.warn(`Request to "${err.response.config.url}" failed with message "${err.response.status} ${err.response.statusText}"`)
      return K.never() // TODO add alert box
    })
  ])
github ivan-kleshnin / unredux / examples / 7.1.crud / client / root / index.js View on Github external
// INTENTS
  let intents = {
    navigateTo$: sources.DOM.from("a").listen("click")
      .map(ee => (ee.event.preventDefault(), ee))
      .map(ee => ee.element.href)
      .map(url => {
        url = Url.parse(url).pathname
        window.history.pushState({}, "", url)
        return url
      }),

    navigateHistory$: D.isBrowser
      ? K.fromEvents(window, "popstate")
          .map(data => document.location.pathname)
      : K.never()
  }

  // STATE
  let state$ = D.run(
    () => D.makeStore({}),
    // D.withLog({key}),
  )(
    // Init
    D.init(seed),
    D.initAsync(sources.state$),

    // Navigation
    intents.navigateTo$.map(url => R.fn("navigateTo", R.set("url", url))),
    intents.navigateHistory$.map(url => R.fn("navigateHistory", R.set("url", url))),

    // Content
github ivan-kleshnin / unredux / examples / 7.crud / client / root / index.js View on Github external
.flatMapConcat(ee => {
        let urlObj = U.parse(ee.element.href)
        if (urlObj.protocol && urlObj.host != document.location.host) {
          // External link
          return K.never()
        }
        else if (ee.event.shiftKey || navigator.platform.match("Mac") ? ee.event.metaKey : ee.event.ctrlKey) {
          // Holding Shift or Ctrl/Cmd
          return K.never()
        }
        else {
          // Internal link
          if (urlObj.pathname == document.location.pathname && urlObj.hash) {
            // Anchor link
            // do nothing, rely on default browser behavior
          } else {
            // Page link or Reset-Anchor link (foo#hash -> foo)
            ee.event.preventDefault() // take control of browser
            window.scrollTo(0, 0)     //
          }
          window.history.pushState({}, "", urlObj.relHref)
          return K.constant(urlObj.relHref)
        }
      }),
github ivan-kleshnin / unredux / examples / 7.crud / client / blueprints.js View on Github external
// Anchor link
              // do nothing, rely on default browser behavior
            } else {
              // Page link or Reset-Anchor link (foo#hash -> foo)
              ee.event.preventDefault() // take control on browser
              window.scrollTo(0, 0)     //
            }
            window.history.pushState({}, "", urlObj.relHref)
            return K.constant(urlObj.relHref)
          }
        }),

      navigateHistory$: D.isBrowser
        ? K.fromEvents(window, "popstate")
          .map(data => U.relHref(document.location.href)) // TODO scroll to hash (how?!)
        : K.never(),
    }
  }
github ivan-kleshnin / unredux / vendors / framework / index.js View on Github external
      action$: page$.flatMapLatest(p => p.action$ || K.never()),
github ivan-kleshnin / unredux / examples / 7.crud / client / root / index.js View on Github external
.map(url => {
      let {mask, params, payload: app} = router.doroute(url)
      app = isolate(app, key + mask, ["DOM", "Component"])
      let sinks = app({...sources, props: {mask, params, router}})
      return R.merge({action$: K.never()}, sinks)
    })
github mAAdhaTTah / brookjs / packages / brookjs-cli / src / deltas / terminalDelta / log.js View on Github external
const error$ = actions$.flatMap(({ type, payload }) => {
        switch (type) {
            case SCAFFOLD_ERROR:
                return Kefir.concat([
                    ui.error(`error scaffolding file: ${payload.error.message}`),
                    setExitCode(1)
                ]);
            case READ_RC_FILE_ERROR:
                return Kefir.concat([
                    ui.error(`error reading .beaverrc.js: ${payload.error.message}`),
                    setExitCode(1)
                ]);
            default:
                return Kefir.never();
        }
    });
github calmm-js / karet.util / dist / karet.util.cjs.js View on Github external
var delay = /*#__PURE__*/I.curry(function delay(ms, xs) {
  if (isObservable(xs)) return xs.delay(ms);else return xs;
});
var mapValue = /*#__PURE__*/I.curry(mapValueU);
var flatMapParallel = /*#__PURE__*/I.curry(flatMapParallelU);
var flatMapSerial = /*#__PURE__*/I.curry(flatMapSerialU);
var flatMapErrors = /*#__PURE__*/I.curry(function flatMapErrors(fn, xs) {
  return toObservable(xs).flatMapErrors(I.pipe2U(fn, toObservable));
});
var flatMapLatest = /*#__PURE__*/I.curry(flatMapLatestU);
var foldPast = /*#__PURE__*/I.curry(function foldPast(fn, s, xs) {
  if (isObservable(xs)) return xs.scan(fn, s);else return fn(s, xs);
});
var interval = /*#__PURE__*/I.curry(K.interval);
var later = /*#__PURE__*/I.curry(K.later);
var never = /*#__PURE__*/K.never();
var on = /*#__PURE__*/I.curry(function on(efs, xs) {
  return toObservable(xs).onAny(toHandler(efs));
});
var sampledBy = /*#__PURE__*/I.curry(function sampledBy(es, xs) {
  return toObservable(xs).sampledBy(es);
});
var skipFirst = /*#__PURE__*/I.curry(function skipFirst(n, xs) {
  return toObservable(xs).skip(n);
});
var skipDuplicates = /*#__PURE__*/I.curry(function skipDuplicates(equals, xs) {
  if (isObservable(xs)) return xs.skipDuplicates(equals);else return xs;
});
var skipUnless = /*#__PURE__*/I.curry(function skipUnless(p, xs) {
  return toObservable(xs).filter(p);
});
var takeFirst = /*#__PURE__*/I.curry(function takeFirst(n, xs) {
github calmm-js / karet.util / dist / karet.util.es.js View on Github external
var delay = /*#__PURE__*/curry(function delay(ms, xs) {
  if (isObservable(xs)) return xs.delay(ms);else return xs;
});
var mapValue = /*#__PURE__*/curry(mapValueU);
var flatMapParallel = /*#__PURE__*/curry(flatMapParallelU);
var flatMapSerial = /*#__PURE__*/curry(flatMapSerialU);
var flatMapErrors = /*#__PURE__*/curry(function flatMapErrors(fn, xs) {
  return toObservable(xs).flatMapErrors(pipe2U(fn, toObservable));
});
var flatMapLatest = /*#__PURE__*/curry(flatMapLatestU);
var foldPast = /*#__PURE__*/curry(function foldPast(fn, s, xs) {
  if (isObservable(xs)) return xs.scan(fn, s);else return fn(s, xs);
});
var interval$1 = /*#__PURE__*/curry(interval);
var later$1 = /*#__PURE__*/curry(later);
var never$1 = /*#__PURE__*/never();
var on = /*#__PURE__*/curry(function on(efs, xs) {
  return toObservable(xs).onAny(toHandler(efs));
});
var sampledBy = /*#__PURE__*/curry(function sampledBy(es, xs) {
  return toObservable(xs).sampledBy(es);
});
var skipFirst = /*#__PURE__*/curry(function skipFirst(n, xs) {
  return toObservable(xs).skip(n);
});
var skipDuplicates = /*#__PURE__*/curry(function skipDuplicates(equals, xs) {
  if (isObservable(xs)) return xs.skipDuplicates(equals);else return xs;
});
var skipUnless = /*#__PURE__*/curry(function skipUnless(p, xs) {
  return toObservable(xs).filter(p);
});
var takeFirst = /*#__PURE__*/curry(function takeFirst(n, xs) {

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