Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
'message.obs.shares': (id) => {
if (!ref.isLink(id)) throw new Error('an id must be specified')
var obs = get(id)
obs.id = id
var result = computed(obs, getShares, {
// allow manual append for simulated realtime
onListen: () => activeShares.add(obs),
onUnlisten: () => activeShares.delete(obs)
})
result.sync = obs.sync
return result
}
})
'message.obs.webshares': (id) => {
if (!ref.isLink(id)) throw new Error('an id must be specified')
var obs = get(id)
obs.id = id
var result = computed(obs, getShares, {
// allow manual append for simulated realtime
onListen: () => activeShares.add(obs),
onUnlisten: () => activeShares.delete(obs)
})
result.sync = obs.sync
return result
}
})
function description ({description, isEditing, onUpdate}) {
const markdown = api.message.html.markdown
const input = h('textarea', {'ev-input': e => onUpdate(e.target.value), value: description})
return h('Description', [
when(isEditing,
input,
computed(description, markdown)
)
])
}
}
return nest('message.html.likes', function likes(msg) {
var id = api.keys.sync.id()
var likes = api.message.obs.likes(msg.key)
var iLike = computed(likes, likes => likes.includes(id))
var count = computed(likes, likes => likes.length ? likes.length : '')
return h('Likes', { 'ev-click': () => publishLike(msg, !iLike()) }, [
h('i.fa', { className: when(iLike, 'fa-heart', 'fa-heart-o') }),
h('div.count', count)
])
})
function renderError () {
return [
h('h1', [ 'Error combining shards!!!' ]),
h('pre', computed(error, e => (e || '').toString())),
h('div.actions', [
when(modalOpen, h('button -subtle', { 'ev-click': () => modalOpen.set(false) }, 'close'), [])
])
]
}
}