code: function () {
      var self = this;
  
      if (self.retired)
        return { committed: function () {} };
  
      if (self.fired)
        throw new Error("fence has already activated -- too late to add writes");
  
      self.outstanding_writes++;
      var committed = false;
      return {
        committed: function () {
          if (committed)
            throw new Error("committed called twice on the same write");
          committed = true;
          self.outstanding_writes--;
          self._maybeFire();
        }
      };
    }
docs: Start tracking a write, and return an object to represent it. The object has a single method, committed(). This method should be called when the write is fully committed and propagated. You can continue to add writes to the WriteFence up until it is triggered (calls its callbacks because all writes have committed.)