• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

TypeScript hyperscript.hyperscript函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了TypeScript中mithril/hyperscript.hyperscript函数的典型用法代码示例。如果您正苦于以下问题:TypeScript hyperscript函数的具体用法?TypeScript hyperscript怎么用?TypeScript hyperscript使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了hyperscript函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。

示例1: renderActionsBar

function renderActionsBar(ctrl: TrainingCtrl) {
  return h('section#training_actions.actions_bar', [
    h('button.action_bar_button.training_action.fa.fa-area-chart', {
      key: 'puzzleMenu',
      oncreate: helper.ontap(ctrl.menu.open)
    }),
    h('button.action_bar_button.training_action.fa.fa-share-alt', {
      key: 'sharePuzzle',
      oncreate: helper.ontap(ctrl.share, () => window.plugins.toast.show('Share this puzzle', 'short', 'bottom'))
    }),
    h('button.action_bar_button.training_action[data-icon=A]', {
      key: 'analysePuzzle',
      oncreate: helper.ontap(ctrl.goToAnalysis, () => window.plugins.toast.show(i18n('analysis'), 'short', 'bottom')),
      disabled: ctrl.vm.mode !== 'view'
    }),
    h('button.action_bar_button.training_action.fa.fa-backward', {
      oncreate: helper.ontap(ctrl.rewind, undefined, ctrl.rewind),
      key: 'historyPrev',
      disabled: !ctrl.canGoBackward()
    }),
    h('button.action_bar_button.training_action.fa.fa-forward', {
      oncreate: helper.ontap(ctrl.fastforward, undefined, ctrl.fastforward),
      key: 'historyNext',
      disabled: !ctrl.canGoForward()
    })
  ])
}
开发者ID:mbensley,项目名称:lichobile,代码行数:27,代码来源:trainingView.ts


示例2: h

export default function BoardBrush(bounds: ClientRect, orientation: Color, shapes: Shape[], pieceTheme: string) {
  if (!shapes) return null
  if (!bounds) return null
  if (bounds.width !== bounds.height) return null

  return h('svg', {
    xmlns: 'http://www.w3.org/2000/svg',
    version: '1.1'
  }, [
    usedBrushes,
    shapes.map(renderShape(orientation, false, brushes, bounds, pieceTheme))
  ])
}
开发者ID:sepiropht,项目名称:lichobile,代码行数:13,代码来源:index.ts


示例3: renderBody

function renderBody() {
  return [
    h('div.native_scroller.page.settings_list.radio_list', [
      h('ul#boardThemes', settings.general.theme.availableBoardThemes.map((t) => {
        return h('li.list_item', {}, [
          formWidgets.renderRadio(
            t[0], 'board_theme', t[1],
            settings.general.theme.board() === t[1],
            e => {
              settings.general.theme.board((e.target as HTMLInputElement).value)
              onBoardThemeChange((e.target as HTMLInputElement).value)
              redraw()
            }
          ),
          h('div.board_icon.vertical_align', {
            className: t[1]
          })
        ])
      }))
    ])
  ]
}
开发者ID:sepiropht,项目名称:lichobile,代码行数:22,代码来源:boardThemes.ts


示例4: h

 h('ul', list.map((t) => {
   const selected = settings.general.theme.background() === t.key
   return h('li.list_item', [
     formWidgets.renderRadio(
       t.name,
       'bg_theme',
       t.key,
       selected,
       e => {
         const val = (e.target as HTMLInputElement).value
         const prevTheme = settings.general.theme.background()
         settings.general.theme.background(val)
         if (val === 'dark' || val === 'light') {
           layout.onBackgroundChange(val)
           redraw()
         } else {
           ctrl.loading = true
           loadImage(val + '.' + t.ext, ctrl.onProgress)
           .then(() => {
             layout.onBackgroundChange(val)
             ctrl.stopLoading()
           })
           .catch(() => {
             settings.general.theme.background(prevTheme)
             ctrl.stopLoading()
             handleError()
           })
           redraw()
         }
       },
       ctrl.loading
     ),
     selected && ctrl.progress ? h('div.theme-progressBarContainer', [
       h('div.theme-progressBar', { style: { transform: `translateX(-${100 - progressPercent(ctrl.progress)}%)` }}),
       h('div.theme-progressInner', progressAmount(ctrl.progress))
     ]) : null
   ])
 }))
开发者ID:mbensley,项目名称:lichobile,代码行数:38,代码来源:theme.ts


示例5: renderMoveTimes

function renderMoveTimes(ctrl: AnalyseCtrl, moveCentis: number[], vd: helper.ViewportDim, isPortrait: boolean) {
  return h('div.analyse-moveTimes', {
    key: 'move-times'
  }, [
    h('strong.title', i18n('moveTimes')),
    h('svg#moveTimes-chart.analyse-chart', {
      key: 'movetimes-chart',
      width: isPortrait ? vd.vw : vd.vw - vd.vh + helper.headerHeight,
      height: 150,
      oncreate({ dom }: Mithril.DOMNode) {
        setTimeout(() => {
          this.updateCurPly = drawMoveTimesChart(dom as SVGElement, ctrl.data, moveCentis, ctrl.node.ply)
        }, 100)
      },
      onupdate() {
        if (this.updateCurPly) batchRequestAnimationFrame(() => {
          if (ctrl.onMainline) this.updateCurPly(ctrl.node.ply)
          else this.updateCurPly(null)
        })
      }
    })
  ])
}
开发者ID:mbensley,项目名称:lichobile,代码行数:23,代码来源:analysisView.ts


示例6: renderAppPrefs

function renderAppPrefs() {
  return [
    h('li.list_item',
      formWidgets.renderMultipleChoiceButton(
        'How do you move pieces?', [
          { label: 'Tap two squares', value: 'tap' },
          { label: 'Drag a piece', value: 'drag' },
          { label: 'Either', value: 'both' },
        ],
        settings.game.pieceMove
      )
    ),
  ]
}
开发者ID:mbensley,项目名称:lichobile,代码行数:14,代码来源:gameBehavior.ts


示例7: view

export default function view(ctrl: Editor) {
  const color = ctrl.chessground.state.orientation
  const opposite = color === 'white' ? 'black' : 'white'
  const isPortrait = helper.isPortrait()
  const bounds = helper.getBoardBounds(helper.viewportDim(), isPortrait)

  const board = h(Board, {
    variant: ctrl.data.game.variant.key,
    chessground: ctrl.chessground,
    bounds
  })

  return layout.board(
    header(i18n('boardEditor')),
    h.fragment({ key: isPortrait ? 'portrait' : 'landscape' }, [
      board,
      h('div.editor-wrapper', [
        h('div#boardEditor.editor-table', {
          className: settings.general.theme.piece(),
          oncreate: ctrl.editorOnCreate,
          onremove: ctrl.editorOnRemove
        }, [
          h('div.editor-piecesDrawer', [
            sparePieces(opposite, color, 'top'),
            sparePieces(color, color, 'bottom')
          ]),
        ]),
        renderActionsBar(ctrl)
      ])
    ]),
    [
      menu.view(ctrl.menu),
      continuePopup.view(ctrl.continuePopup),
      pasteFenPopup.view(ctrl.pasteFenPopup)
    ]
  )
}
开发者ID:mbensley,项目名称:lichobile,代码行数:37,代码来源:editorView.ts


示例8: renderBody

function renderBody() {
  return h('div', {
    style: { width: '100%', height: '100%' }
  }, [
    h('ul.settings_list.general.native_scroller.page', [
      utils.hasNetwork() && session.isConnected() ? h('li.list_item.nav', {
        key: 'preferences',
        oncreate: helper.ontapY(() => router.set('/settings/preferences'))
      }, i18n('preferences')) : null,
      h('li.list_item.nav', {
        key: 'lang',
        oncreate: helper.ontapY(() => router.set('/settings/lang'))
      }, i18n('language')),
      h('li.list_item.nav', {
        key: 'gameDisplay',
        oncreate: helper.ontapY(() => router.set('/settings/gameDisplay'))
      }, i18n('gameDisplay')),
      h('li.list_item.nav', {
        key: 'theme',
        oncreate: helper.ontapY(() => router.set('/settings/theme'))
      }, `${i18n('theming')}`),
      h('li.list_item.nav', {
        key: 'boardTheme',
        oncreate: helper.ontapY(() => router.set('/settings/themes/board'))
      }, i18n('board')),
      h('li.list_item.nav', {
        key: 'piecesTheme',
        oncreate: helper.ontapY(() => router.set('/settings/themes/piece'))
      }, i18n('pieces')),
      h('li.list_item.nav', {
        key: 'soundNotifications',
        oncreate: helper.ontapY(() => router.set('/settings/soundNotifications'))
      }, i18n('soundAndNotifications'))
    ]),
    window.AppVersion ? h('section.app_version', 'v' + window.AppVersion.version) : null
  ])
}
开发者ID:sepiropht,项目名称:lichobile,代码行数:37,代码来源:index.ts


示例9: renderTitle

function renderTitle(ctrl: IRetroCtrl): Mithril.BaseNode {
  const completion = ctrl.completion()
  return h('div.title', [
    h('span', 'Learn from your mistakes'),
    h('span', Math.min(completion[0] + 1, completion[1]) + ' / ' + completion[1]),
    h('div.retro-actions', [
      h('button.window-button', {
        oncreate: helper.ontap(ctrl.toggleWindow)
      }, h('span.fa', {
        className: ctrl.vm.minimized ? 'fa-window-maximize' : 'fa-window-minimize'
      })),
      h('button.window-button', {
        oncreate: helper.ontap(ctrl.close)
      }, h('span.fa.fa-window-close'))
    ])
  ])
}
开发者ID:mbensley,项目名称:lichobile,代码行数:17,代码来源:retroView.ts


示例10: h

    return h('div.analyse-evalSummary', ['white', 'black'].map((color: Color) => {
      const p = gameApi.getPlayer(d, color)
      const pName = study ? findTag(study, color) || 'Anonymous' : playerName(p)

      return h('table', [
        h('thead', h('tr', [
          h('th', h('span.color-icon.' + color)),
          h('td', [pName, p ? helper.renderRatingDiff(p) : null])
        ])),
        h('tbody', [
          advices.map(a => {
            const nb = analysis && analysis[color][a[0]]
            return h('tr', [
              h('th', nb),
              h('td', i18n(a[1]))
            ])
          }),
          h('tr', [
            h('th', analysis && analysis[color].acpl),
            h('td', i18n('averageCentipawnLoss'))
          ])
        ])
      ])
    }))
开发者ID:mbensley,项目名称:lichobile,代码行数:24,代码来源:analysisView.ts



注:本文中的mithril/hyperscript.hyperscript函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
TypeScript hyperscript.trust函数代码示例发布时间:2022-05-25
下一篇:
TypeScript mithril.route类代码示例发布时间:2022-05-25
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap