本文整理汇总了TypeScript中@cycle/xstream-run.run函数的典型用法代码示例。如果您正苦于以下问题:TypeScript run函数的具体用法?TypeScript run怎么用?TypeScript run使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了run函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: run
import main from './main';
import { run } from '@cycle/xstream-run';
import { makeDOMDriver } from '@cycle/dom';
run(main, {
dom: makeDOMDriver('#app')
});
开发者ID:artfuldev,项目名称:recall-cycle,代码行数:7,代码来源:app.ts
示例2: 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()
});
开发者ID:wpcfan,项目名称:calltalent_web_cyclejs,代码行数:12,代码来源:index.ts
示例3: run
import {run} from '@cycle/xstream-run';
import {makeDOMDriver} from '@cycle/dom';
import Counter from './Counter';
const main = Counter;
run(main, {
DOM: makeDOMDriver('#main-container')
});
开发者ID:mxstbr,项目名称:cyclejs-counter,代码行数:9,代码来源:index.ts
示例4: run
// return {
// name: s.name,
// input
// }
// }).debug((x: any) => console.log('debug', x)) // Object {name...}
// ).debug((x: any) => console.log('debug2', x)) // Stream
// .flatten()
// .debug((x: any) => console.log('debug3', x)) // nothing
sendUpdate: xs.combine(
state$.compose(dropRepeats<Model>((a, b) => a.shows === b.shows)),
keyboard.filter((x: Input) => x === 'increment' || x === 'decrement')
)
.compose(debounce(100))
.map(([state, input]: [Model, Input]): Update => {
const s = state.shows[state.cursor];
return {
name: s.name,
count: s.count,
input
}
})
};
}
run(main, {
DOM: makeDOMDriver('#app'),
keyboard: makeKeyboardDriver(),
scrollIntoView: makeScrollIntoViewDriver(),
sendUpdate: makeSendUpdateDriver()
});
开发者ID:justinwoo,项目名称:tracker,代码行数:30,代码来源:index.ts
示例5: run
document.addEventListener('DOMContentLoaded', () => run(main, drivers));
开发者ID:sambou,项目名称:cyclejs-boilerplate,代码行数:1,代码来源:index.ts
示例6: makeDOMDriver
data: { id, label }
})),
board.noteDelete$.map(id => ({
type: 'delete-note',
data: { id }
}))
)
return {
DOM: board.DOM,
websocket: Stream.merge(boardWebsocket$, Stream.of({ type: 'init' }))
.debug('websocket$'),
preventDefault: board.preventDefault,
focus: board.focus,
}
}
Cycle.run(main, {
DOM: makeDOMDriver('#root'),
websocket: createWebsocketDriver('http://localhost:3000'),
focus: createFocusDriver(),
preventDefault: (event$: Stream<Event>) => {
event$.addListener({
next: (e) => e.preventDefault(),
error: (err) => console.error(err),
complete: () => {}
})
return {}
},
})
开发者ID:JamesHageman,项目名称:xstream-scrumbler,代码行数:30,代码来源:index.ts
示例7: main
import xs from "xstream";
import {run} from "@cycle/xstream-run";
import {makeDOMDriver, h1} from "@cycle/dom";
function main() {
const sinks = {
DOM: xs.periodic(1000).map(i => h1('' + i + " seconds elapsed"))
};
return sinks;
}
const drivers:{[name:string]: Function} = {
DOM: makeDOMDriver("#app")
}
run(main, drivers);
开发者ID:udondokodoon,项目名称:touchevents,代码行数:18,代码来源:main.ts
示例8: send
action$: gameAction$ as Stream<Action>
});
const stateForClients$ = state$
.map(state => ({type: 'UPDATE_STATE', data: state}));
const stateUpdate$ = stateForClients$.map(broadcast);
const newConnection$ = sources.Socket.connections;
const newClientState$ = stateForClients$
.map(state => newConnection$.map(id => send(id, state)))
.flatten();
const setClientId$ = newConnection$
.map(id => send(id, {type: 'SET_ID', data: id}));
const socket$ = xs.merge(
stateUpdate$,
newClientState$,
setClientId$
);
return {
Socket: socket$
}
}
server.listen(8000, () => console.log(`Listening on localhost:8000`));
run(Server, drivers);
开发者ID:Widdershin,项目名称:schism,代码行数:30,代码来源:server.ts
示例9: next
ws.onmessage = (data, flags) => {
observer.next(JSON.parse(data.data));
};
ws.onopen = () => {
sink$.addListener({
next (message) {
console.log('outgoing message', message);
ws.send(JSON.stringify(message));
}
});
startup.shamefullySendNext('');
};
return {
messages: stream,
startup
};
}
}
const drivers = {
DOM: makeDOMDriver('.app'),
Animation: makeAnimationDriver(),
Socket: makeWebSocketDriver(new WebSocket(`ws://${location.host}/websocket`))
};
run(Client, drivers);
开发者ID:Widdershin,项目名称:schism,代码行数:29,代码来源:client.ts
示例10: h
import xs from 'xstream';
import {run} from '@cycle/xstream-run';
import {makeDOMDriver, h} from '@cycle/dom';
const App = () => ({
DOM: xs.of(
h('div.app', [
h('h1', 'Enter the lairs'),
h('p', 'Lorem ipsum')
])
)
});
// tslint:disable-next-line:no-expression-statement
run(App, {
DOM: makeDOMDriver(document.getElementById('app'))
});
开发者ID:cutepig,项目名称:typescript-cycle-baseline,代码行数:17,代码来源:index.ts
注:本文中的@cycle/xstream-run.run函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论