MCPcopy
hub / github.com/apache/pouchdb / adapterFun

Function adapterFun

lib/index-browser.js:163–186  ·  view source on GitHub ↗
(name, callback)

Source from the content-addressed store, hash-verified

161}
162
163function adapterFun(name, callback) {
164 return toPromise(function (...args) {
165 if (this._closed) {
166 return Promise.reject(new Error('database is closed'));
167 }
168 if (this._destroyed) {
169 return Promise.reject(new Error('database is destroyed'));
170 }
171 var self = this;
172 logApiCall(self, name, args);
173 if (!this.taskqueue.isReady) {
174 return new Promise(function (fulfill, reject) {
175 self.taskqueue.addTask(function (failed) {
176 if (failed) {
177 reject(failed);
178 } else {
179 fulfill(self[name].apply(self, args));
180 }
181 });
182 });
183 }
184 return callback.apply(this, args);
185 });
186}
187
188// like underscore/lodash _.pick()
189function pick(obj, arr) {

Callers 4

_setupMethod · 0.70
index-browser.jsFile · 0.70
adapterFun$$1Function · 0.70
HttpPouchFunction · 0.70

Calls 3

toPromiseFunction · 0.70
logApiCallFunction · 0.70
addTaskMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…