本文整理匯總了TypeScript中rx.Observable.never方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript Observable.never方法的具體用法?TypeScript Observable.never怎麽用?TypeScript Observable.never使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類rx.Observable
的用法示例。
在下文中一共展示了Observable.never方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: makeTelegramDriver
export function makeTelegramDriver (
token: Token,
options: DriverOptions = {}
) {
let state: TcombUpdatesState = {
startDate: options.startDate || Date.now(),
offset: 0,
updates: []
}
let proxyUpdates = options.skipUpdates ? $.never<TcombUpdatesState>() : makeUpdates(state, token)
let proxyWebHook = new Subject<any>()
if (options.webhook) {
proxyUpdates = makeWebHook(state, proxyWebHook)
}
let updates = proxyUpdates
.doOnError((err: any) => {
console.error('updates error: ', err)
console.warn('Waiting 30 seconds before retry...')
})
.catch(proxyUpdates.delay(30000))
.replay(null, 1)
let sources = makeSources(updates)
let disposable = updates.connect()
function telegramDriver (sourceRequest: Observable<Observable<DriverSink>>, runSA: StreamAdapter): DriverExecution {
let adapt = adapter(runSA)
let request = sourceRequest.map(x => convertStream(x, runSA, RxAdapter))
if (isWebhookResponse(request, options)) {
handleWebhook(token, request, proxyWebHook)
}
let responses = handleRequest(token, request as Observable<Observable<TcombRequest>>).share()
responses.subscribeOnError((err: any) => console.error('request error: ', err))
return Object.assign(
{
token,
dispose: () => disposable.dispose()
},
mapObjIndexed(adapt, {
events: makeEventsSelector(sources),
updates,
responses
})) as DriverExecution
}
(telegramDriver as any).streamAdapter = RxAdapter
return telegramDriver
}