MCPcopy
hub / github.com/ro31337/libretaxi / load

Method load

src/stateful.js:114–128  ·  view source on GitHub ↗

* Loads data from the storage and inits database connection. * This method must be executed before using `save` or `dispose`. * * @author Roman Pushkin (roman.pushkin@gmail.com) * @date 2016-05-20 * @version 1.1 * @since 0.1.0 * @return {Promise} promise that resol

()

Source from the content-addressed store, hash-verified

112 * @return {Promise} promise that resolves when data has been loaded.
113 */
114 load() {
115 this.init();
116 return new Promise((resolve) => {
117 this.db = firebaseDB.config().ref(this.firebasePath);
118 this.db.on('value', (snapshot) => {
119 const value = snapshot.val();
120
121 if (value) {
122 Object.assign(this.state, value);
123 }
124
125 resolve(this);
126 });
127 });
128 }
129
130 /**
131 * Updates the storage with current state. Will only overwrite the

Callers 15

checkAnotherFunction · 0.80
stateful-test.jsFile · 0.80
callbackFunction · 0.80
verifyFunction · 0.80
updateFunction · 0.80
loadOrderFunction · 0.80
loadUserFunction · 0.80

Calls 1

initMethod · 0.80

Tested by

no test coverage detected