kappa-view-list
has a function called tail(limit, fn)
that will watch the last limit
messages of the sorted list and run fn
as fn(msgs)
whenever that window changes, supplying the new last limit
messages.
Copy your old code back over that lets you read process.stdin
for lines of text & writes them to the feed.
Then, modify your code to listen for chat view changes and re-write the last 10 chat messages to the terminal.
tail
will fire its callback every time the bottom of the list updates, including initial indexing when the program starts!core.ready(function () { ... })
to run code after the views have caught up with what's already in the database.Once you solve this exercise continue to exercise 12