lrperlmu / emotional_clarity

Micro interventions to help teens get through stress.
0 stars 2 forks source link

Logging #69

Closed lrperlmu closed 4 years ago

lrperlmu commented 4 years ago

Issue #21 Logging!

Major Changes logger.js :deciduous_tree:

Testing firebase_test.html, firebase_test.js

Minor Changes demo.html

model.js

dbt_worksheet_model.js

nav.js

lrperlmu commented 4 years ago

Rachel -- this code uses a javascript concept that might be new to you: Promises.

You can think of a promise as an object that stores a code snippet that is executing asynchronously, the code's return value, and manages things to do after that code snippet finishes executing.

So, for example, this.signIn is a promise whose code snippet signs in to the database and returns a user credential. You'll find a construction like this appears a couple of times:

        this.signIn.then(credential => {
            // some stuff
        });

That basically means: "Assuming that sign-in is complete and has returned an object called credential, execute "some stuff".

If you want to know more, javascript.info has a (very long winded) section on Promises, and we can also talk about it at tomorrow's meeting.