This is a read-only archive of the Framer Community on Facebook.

What is Framer? Join the Community
Return to index
Frank Boeree
Posted Feb 15 - Read on Facebook

Hello! I'm playing around with firebase a bit and the possibilities look promising.

So far I managed to register 2 separate click events from Framer in Firebase and send the unique code back to the 'print window' in Framer. Now I want translate the code in the 'print window' to a 'clicks counter' but don't really now how to count the 1's and 2's I Receive back from Firebase. Does anyone has an idea?

Thanks in advance :)

6 Comments

Jonas Treub

Marc might be able to help you out!

Marc Krenn

Multiple ways to do this :)

The easiest one with your current setup (off the top of my head):

firebase.get("/teamred/"), (rsp) -> print "Red count: #{_.toArray(rsp).length}"

So you don't count the 1s and 2s itself, but rather, how many childs there are at a certain node (teamred/teamblue)

This approach comes at the cost of having to load the whole "teamred"-node in order to count its children on the client side, which is not that elegant but makes sure you don't "lose" any counts when multiple people using your prototype at the same time.

Other solution involve some sort of backend sorting or logic.

Frank Boeree

Awesome! It seems to work! Once finished i'll upload the result :)

Frank Boeree

Would it also be possible to let Framer check the database automatically without the need of a click in the prototype? https://framer.cloud/wByuD/6

Jonas Treub

You can use an interval to check the data once every few seconds.

Read the entire post on Facebook