CountOf
CountOf reports how many addresses hold one particular reaction on page.
Command
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/reactions/v0.CountOf(,)"
Result
Package reactions is a reaction block any realm can embed, keyed on the page it appears on rather than on the realm that stores it.
It is the shape the web settled on for this in 2010: one hosted widget, the same snippet pasted everywhere, deciding what to show from the page identifier it is handed. Here the snippet is two lines of gno:
1import "gno.land/r/moul/reactions/v0"
2
3func Render(path string) string {
4 return body + reactions.RenderBlock()
5}
RenderBlock takes no argument because it does not need one: a plain read exported by a realm and called by another opens no realm frame, so unsafe.CurrentRealm() inside it reports the CALLER. The host realm's own path is the page key, and nothing has to be configured, registered or passed. RenderBlockFor is the explicit form, for a realm that renders more than one page or already holds its path as a constant.
The host realm stores nothing. Every tally lives here, so a realm can add reactions without a redeploy the next time it wants to change them, and a reader's reaction survives the host realm being replaced.
Not a comment system. There is no text field anywhere, which is what makes it possible to run with no moderation at all: six emoji, one reaction per address per page, changeable and removable. The page shows the tally and who reacted last. That is the whole feature.
CountOf reports how many addresses hold one particular reaction on page.
gnokey query vm/qeval -remote "https://rpc.gno.land" -data "gno.land/r/moul/reactions/v0.CountOf(,)"