function hookUpdatingChain()

in public/dexie.js [604:626]


  function hookUpdatingChain(f1, f2) {
    if (f1 === nop) return f2;
    return function (modifications) {
      var res = f1.apply(this, arguments);
      extend(modifications, res); // If f1 returns new modifications, extend caller's modifications with the result before calling next in chain.
      var onsuccess = this.onsuccess, // In case event listener has set this.onsuccess
        onerror = this.onerror; // In case event listener has set this.onerror
      this.onsuccess = null;
      this.onerror = null;
      var res2 = f2.apply(this, arguments);
      if (onsuccess)
        this.onsuccess = this.onsuccess
          ? callBoth(onsuccess, this.onsuccess)
          : onsuccess;
      if (onerror)
        this.onerror = this.onerror ? callBoth(onerror, this.onerror) : onerror;
      return res === undefined
        ? res2 === undefined
          ? undefined
          : res2
        : extend(res, res2);
    };
  }