当前位置: 首页>>代码示例>>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;未经允许,请勿转载。