本文整理汇总了TypeScript中@cycle/http.makeHTTPDriver函数的典型用法代码示例。如果您正苦于以下问题:TypeScript makeHTTPDriver函数的具体用法?TypeScript makeHTTPDriver怎么用?TypeScript makeHTTPDriver使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了makeHTTPDriver函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: run
import {run} from '@cycle/xstream-run';
import {makeDOMDriver} from '@cycle/dom';
import { makeHTTPDriver } from '@cycle/http';
import Login from './Login';
// import BmiCalculator from './BmiCalculator';
// const main = BmiCalculator;
const main = Login
run(main, {
DOM: makeDOMDriver('#main-container'),
HTTP: makeHTTPDriver()
});
示例2: constructor
constructor(commitsRequest$: Stream<string>) {
const request$ = commitsRequest$.map(sha => toRequestOptions(sha));
this.http = makeHTTPDriver()(request$, 'githubHttp');
}
示例3: run
console.clear();
import {Observable} from 'rxjs';
import {run} from '@cycle/rxjs-run';
import {div, input, li, hr, h1, button, b, br, span, ul, label, makeDOMDriver} from '@cycle/dom';
import {makeHTTPDriver} from '@cycle/http';
import * as $ from 'jquery';
run(main, {DOM: makeDOMDriver('#app'), HTTP: makeHTTPDriver()});
function main(sources) {
const loadButton$ = sources.DOM.select('button').events('click')
.startWith(null);
const searchInput$ = sources.DOM.select('#search').events('input');
const search$ = searchInput$
.map(evt => evt.target.value)
.startWith('');
const request$ = loadButton$
.mapTo({
url: eldenStream(),
method: 'GET',
headers: {
'Content-Type': 'application/json; charset=utf-8',
'Access-Control-Allow-Origin': '*',
},
category: 'eldenStream'
})
;
const products$ = sources.HTTP
示例4: makeHTTPDriver
['HTTP', () => makeHTTPDriver()],