本文整理汇总了TypeScript中mithril/hyperscript.trust函数的典型用法代码示例。如果您正苦于以下问题:TypeScript trust函数的具体用法?TypeScript trust怎么用?TypeScript trust使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了trust函数的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: content
function content() {
const nbPlayersStr = i18n('nbConnectedPlayers', nbPlayers || '?')
const nbGamesStr = i18n('nbGamesInPlay', nbGames || '?')
if (currentSetup === null) {
return h('div.lobby-waitingPopup', 'Something went wrong. Please try again')
}
return h('div.lobby-waitingPopup', [
h('div.lobby-waitingForOpponent', i18n('waitingForOpponent')),
h('br'),
isPoolMember(currentSetup) ?
renderPoolSetup(currentSetup) :
renderCustomSetup(currentSetup),
h('br'),
spinner.getVdom(),
h('div.lobby-nbPlayers', socket.isConnected() ? [
h('div',
h.trust(nbPlayersStr.replace(/(\d+)/, '<strong>$1</strong>'))
),
h('div',
h.trust(nbGamesStr.replace(/(\d+)/, '<strong>$1</strong>'))
),
] : h('div', [i18n('reconnecting'), loader])),
h('button[data-icon=L]', {
oncreate: helper.ontap(() => userCancelSeeking())
}, i18n('cancel'))
])
}
示例2: renderStudyMenu
function renderStudyMenu(ctrl: AnalyseCtrl) {
return h('div.analyseMenu', [
h('button[data-icon=U]', {
key: 'continueFromHere',
oncreate: helper.ontap(() => {
ctrl.menu.close()
ctrl.continuePopup.open(ctrl.node.fen, ctrl.data.game.variant.key, ctrl.data.player.color)
})
}, i18n('continueFromHere')),
h('button', {
key: 'boardEditor',
oncreate: helper.ontap(() => router.set(`/editor/${encodeURIComponent(ctrl.node.fen)}`))
}, [h('span.fa.fa-pencil'), i18n('boardEditor')]),
h('button', {
key: 'share',
oncreate: helper.ontap(() => {
ctrl.study!.actionMenu.s.showShareMenu = true
})
}, [h('span.fa.fa-share'), 'Share']),
h('button', {
key: 'like',
oncreate: helper.ontap(ctrl.study!.toggleLike)
}, [
h.trust(' '),
h('span.fa', {
className: ctrl.study!.data.liked ? 'fa-heart' : 'fa-heart-o'
}),
`Like (${ctrl.study!.data.likes})`
]),
])
}
示例3: h
return node.comments!.map(comment => {
if (comment.by === 'lichess' && !ctx.showComputer) return null
const by = comment.by ? h('span.by', commentAuthorText(comment.by)) : null
return rich ? h('comment', h.trust(linkify(comment.text))) : h('comment', [
by,
truncateComment(comment.text, 300, ctx)
])
}).filter(x => !!x)
示例4: renderUserInfosOnline
function renderUserInfosOnline(user: PuzzleUserData) {
const { vw } = helper.viewportDim()
let width: number
// see overlay-popup.styl for popup width
if (vw >= 900) width = vw * 0.4
else if (vw >= 800) width = vw * 0.45
else if (vw >= 700) width = vw * 0.5
else if (vw >= 600) width = vw * 0.55
else if (vw >= 500) width = vw * 0.6
else width = vw * 0.85
const height = 200
const rating = user.rating
return [
h('p.trainingRatingHeader', h.trust(i18n('yourPuzzleRatingX', `<strong>${rating}</strong>`))),
user.recent ? h('svg#training-graph', {
width,
height,
oncreate() {
drawChart(user)
}
}) : null,
renderRecent(user),
]
}
示例5: h
h('tbody', study.data.chapter.tags.map(([tagName, tagValue]) =>
h('tr.study-tag', [
h('th', tagName),
h('td', h.trust(linkify(tagValue)))
])))
示例6: h
return h('div.native_scroller.study-comments', comments.map(c =>
h('div.study-comment', [
h('div.by', (typeof c.by === 'string' ? c.by : c.by.name) + ':'),
h('div', h.trust(linkify(c.text)))
])