view: use IIFE to make conditional vnode easier to grok

This commit is contained in:
Feross Aboukhadijeh
2016-03-02 02:09:00 -08:00
parent a17bf15382
commit 589b49e8a8

View File

@@ -27,7 +27,11 @@ function App (state, handler) {
h('.name.ellipsis', torrent.name || 'Loading torrent...'),
h('.status', [
h('span.progress', Math.floor(100 * torrent.progress) + '%'),
(torrent.ready && torrent.files.length > 1) ? h('span.files', torrent.files.length + ' files') : ''
(function () {
if (torrent.ready && torrent.files.length > 1) {
return h('span.files', torrent.files.length + ' files')
}
})()
])
]),
h('a.play', {