Delaying in meteor, several attempts and nothing yet


#1

Hey everyone, I have asked this question multiple times on stack exchange but nothing has been proven to work so far and there are some concepts I have trouble implementing.

It’ll make more sense if you took a look at my meteorpad example Linked Here. Basically I’m trying to delay the message from updating for one second, so if there are many messages being posted it can properly fade in and be gauranteed to be seen before the next message gets shown. Right now if someone was to post many messages really fast it would not be seen as the fade did not complete.

I have tried setInterval inside the onRendered with a session.get and it did not work - someone said to try _.throttle and wrap it around my fade but didn’t know what to connect it to as the underscore throttle doc only gave an example on .scroll() when I need something which would start automatically (I’m guessing)


#2

Have you tried using an observer, http://docs.meteor.com/#/full/observe, listening for document inserted to the Secret collection. When a doc is inserted, add that document to a queue (array), and check every second with an interval if the list has a size, and shift the queue and show the first element. Have a feeling that should work.