當前位置: 首頁>>代碼示例>>TypeScript>>正文


TypeScript rxjs-run.default函數代碼示例

本文整理匯總了TypeScript中@cycle/rxjs-run.default函數的典型用法代碼示例。如果您正苦於以下問題:TypeScript default函數的具體用法?TypeScript default怎麽用?TypeScript default使用的例子?那麽, 這裏精選的函數代碼示例或許可以為您提供幫助。


在下文中一共展示了default函數的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。

示例1: makeTelegramDriver

test.skip('should answer callback query with basic driver', t => {
  let basicDriver = makeTelegramDriver(ACCESS_TOKEN)
  let main = ({ bot }: Sources) => ({
    bot: $.from([
      bot.events('message').map(reply({
        text: 'Test message',
        reply_markup: {
          inline_keyboard: [
            [{ text: '1', callback_data: 'one' }],
            [{ text: '2', callback_data: 'two' }]
          ]
        }
      })),
      bot.events('callback_query')
        .map(x => answerCallbackQuery(
          { text: x.callback_query.data, show_alert: true },
          x))
        .do(() => {
          bot.dispose()
          t.end()
        })
    ])
  })
  let { sources, run } = Cycle(main, { bot: basicDriver })

  run()
  sources.bot.responses
    .take(1)
    .subscribe(
      console.log.bind(console),
      onError(sources, t))
})
開發者ID:goodmind,項目名稱:cycle-telegram,代碼行數:32,代碼來源:rxjs.ts

示例2: function

 beforeBind: function (view: View & {bindingContext; controller: Controller}) {
   if (view.controller !== null) {
     const context = view.controller.viewModel as any
     
     if (!context || typeof context.cycle !== 'function') return
     const count = context._cycleCount = (context._cycleCount || 0) + 1
 
     if (context._cycleCount > 1) {
       logger.error('would run the cycle more then once!', count)
       return
     }
 
     const preparedSources = context.cycleDrivers || {}
     const { drivers, onBind, onUnbind, dispose } = makeBindingDrivers(context, diContainer) //observerLocator, strategyLocator, signaler
     
     Object.assign(preparedSources, drivers)
     
     onBind()
     
     context._cycleOnUnbind = onUnbind
     
     const {run, sources, sinks} = Cycle(context.cycle.bind(context), preparedSources)
     const disposeFunction = run()
     
     const _cycleDispose = () => {
       dispose()
       disposeFunction()
     }
 
     context._cycleDispose = _cycleDispose
   }
   
 },
開發者ID:niieani,項目名稱:aurelia-cycle,代碼行數:33,代碼來源:index.ts


注:本文中的@cycle/rxjs-run.default函數示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。