How to use @cycle/http - 10 common examples

To help you get started, we’ve selected a few @cycle/http 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 cyclejs-community / redux-cycles / configureStore.js View on Github external
import { createStore, applyMiddleware, compose } from 'redux';
import { createEpicMiddleware } from 'redux-observable';
import { browserHistory } from 'react-router';
import { routerMiddleware } from 'react-router-redux';
import rootReducer from './reducers';
import main from './cycle';
import { createCycleMiddleware } from './createCycleMiddleware';
import {makeHTTPDriver} from '@cycle/http';

const cycleMiddleware = createCycleMiddleware(main, { HTTP: makeHTTPDriver() });

export default function configureStore() {
  const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
  const store = createStore(
    rootReducer,
    composeEnhancers(
      applyMiddleware(
        cycleMiddleware,
        routerMiddleware(browserHistory)
      )
    )
  );
  return store;
}
github cyclejs / collection / examples / taskrunner / index.js View on Github external
import {run} from '@cycle/run';
import {makeDOMDriver} from '@cycle/dom';
import {makeHTTPDriver} from '@cycle/http';

var app = require('./app').default;

const drivers = {
  DOM: makeDOMDriver('.app'),
  HTTP: makeHTTPDriver()
};

run(app, drivers);
github cyclejs / cyclejs / http / examples / search / search.js View on Github external
h('li.search-result', [
            h('a', {href: result.html_url}, result.name)
          ])
        ))
      ])
    );

  return {
    DOM: vtree$,
    HTTP: searchRequest$
  };
}

const drivers = {
  DOM: makeDOMDriver('.js-container'),
  HTTP: makeHTTPDriver()
}

Cycle.run(main, drivers);
github cyclejs-community / redux-cycles / example / configureStore.js View on Github external
const composeEnhancers = window.__REDUX_DEVTOOLS_EXTENSION_COMPOSE__ || compose;
  const store = createStore(
    rootReducer,
    composeEnhancers(
      applyMiddleware(
        cycleMiddleware,
        routerMiddleware(browserHistory)
      )
    )
  );

  run(main, {
    ACTION: makeActionDriver(),
    STATE: makeStateDriver(),
    Time: timeDriver,
    HTTP: makeHTTPDriver(),
  })

  return store;
}
github cyclejs / cyclejs / examples / intermediate / http-search-github / src / main.js View on Github external
])
        ))
      ])
    );

  const request$ = xs.merge(searchRequest$, otherRequest$);

  return {
    DOM: vtree$,
    HTTP: request$,
  };
}

run(main, {
  DOM: makeDOMDriver('#main-container'),
  HTTP: makeHTTPDriver(),
  Time: timeDriver
});
github andreloureiro / cyclejs-starter / js / main.js View on Github external
import {run} from '@cycle/xstream-run';
import {makeDOMDriver} from '@cycle/dom';
import {makeHTTPDriver} from '@cycle/http';
import {createHistory} from 'history';
import {makeRouterDriver} from 'cyclic-router';
import Router from './components/Router/index';

const drivers = {
  DOM: makeDOMDriver('#root'),
  HTTP: makeHTTPDriver(),
  router: makeRouterDriver(createHistory(), {capture: true})
};

run(Router, drivers);
github kibin / cycle-example-who-to-follow / src / index.js View on Github external
import { makeHTTPDriver } from '@cycle/http'

import { Box } from 'dialogues/box'

function main(sources) {
  const box = Box(sources)

  return {
    DOM: box.DOM,
    HTTP: box.HTTP,
  }
}

const { sinks, sources } = run(main, {
  DOM: makeDOMDriver(`#content`),
  HTTP: makeHTTPDriver(),
})

if (module.hot) {
  module.hot.accept()

  module.hot.dispose(_ => (sinks.dispose(), sources.dispose()))
}
github Cmdv / cycle-natural-language-search / src / client / main.js View on Github external
import {makeHistoryDriver}  from 'cyclic-history'
import {makeRouterDriver}   from 'cyclic-router'
import {createHashHistory}  from 'history'
import {makeStateDriver}    from './state-driver'

import Main                 from './app'

require("!style!css!./styles/pure-min.css");
require("!style!css!./styles/layout.css");
require("!style!css!./styles/grids-responsive-min.css");

const sources = {
  DOM: makeDOMDriver('#application'),
  router: makeRouterDriver(makeHistoryDriver(createHashHistory())),
  //state$: makeStateDriver(),
  HTTP: makeHTTPDriver(),
};

run(Main,sources);
github aronallen / cycle-sandbox / sample / widget.ts View on Github external
fill: 'black',
                x: 0,
                y: 12
              }
            },
              title
            )
          ]
        )
      )
    )
  };
}

setup(Component, {
  HTTP: makeHTTPDriver()
}, {
  DOM: DOMWorkerConnector
}, run);
github lucamezzalira / jsday-cycle-js / src / Main.js View on Github external
if(data)
                            body = getBody(JSON.parse(data));
                        
                        return body;
                    });

    return {
        DOM: vtree$,
        HTTP: linesRequest$
    };
    
}

const drivers = {
    DOM: makeDOMDriver("body"),
    HTTP: makeHTTPDriver()
}

Cycle.run(main, drivers);

@cycle/http

A Cycle.js Driver for making HTTP requests

MIT
Latest version published 4 years ago

Package Health Score

65 / 100
Full package analysis

Similar packages