MCPcopy
hub / github.com/sunnylqm/react-native-storage / getBatchDataWithIds

Method getBatchDataWithIds

storage.js:158–181  ·  view source on GitHub ↗
(params)

Source from the content-addressed store, hash-verified

156 return Promise.all(tasks);
157 }
158 getBatchDataWithIds(params) {
159 let { key, ids, syncInBackground, syncParams } = params;
160
161 return Promise.all(
162 ids.map((id) => this.load({ key, id, syncInBackground, autoSync: false, batched: true, syncParams }))
163 ).then((results) => {
164 return new Promise((resolve, reject) => {
165 const ids = results.filter((value) => value.syncId !== undefined);
166 if(!ids.length){
167 return resolve();
168 }
169 return this.sync[key]({
170 id: ids.map((value) => value.syncId),
171 resolve,
172 reject,
173 syncParams
174 });
175 }).then((data) => {
176 return results.map(value => {
177 return value.syncId ? data.shift() : value
178 });
179 });
180 })
181 }
182 _lookupGlobalItem(params) {
183 let ret;
184 let { key } = params;

Callers 1

Calls 1

loadMethod · 0.95

Tested by

no test coverage detected