async save(asBatch=false){
    if (! this.isInitialized) await this.init();
    if (this.parent) {
      if (this.parent.saved){
        this.data.parentItem = this.parent.data.key;
      } else {
        this.parent.on("saved", key => {
          this.data.parentItem = key;
          this.save(asBatch);
        });
        return Promise.resolve(null);
      }
    }
    Item.queue.push(this);
    if (asBatch) return Promise.resolve(null);
    return (await Item.sendAll())[0];
  }
/**
   * Saves the item on the Zotero server. Returns a Promise.
   * @param asBatch
   *    If true (defaults to false), do not send right away, but put on a queue to
   *    send in a batch by calling Item.saveAll()
   * @return {Promise<Item|null>}
   *    The Promise resolves to the sent Item if asBatch is false, or null if asBatch is true or if the item has a parent
   *    that needs to be saved to the server first.
   */
Saves the item on the Zotero server. Returns a Promise.
@param asBatch
If true (defaults to false), do not send right away, but put on a queue to
send in a batch by calling Item.saveAll()
@return {Promise}
The Promise resolves to the sent Item if asBatch is false, or null if asBatch is true or if the item has a parent
that needs to be saved to the server first.
Saves the item on the Zotero server . Returns a Promise . @param asBatch If true ( defaults to false ) do not send right away but put on a queue to send in a batch by calling Item . saveAll () @return { Promise } The Promise resolves to the sent Item if asBatch is false or null if asBatch is true or if the item has a parent that needs to be saved to the server first .
async save(asBatch=false){
    if (! this.isInitialized) await this.init();
    if (this.parent) {
      if (this.parent.saved){
        this.data.parentItem = this.parent.data.key;
      } else {
        this.parent.on("saved", key => {
          this.data.parentItem = key;
          this.save(asBatch);
        });
        return Promise.resolve(null);
      }
    }
    Item.queue.push(this);
    if (asBatch) return Promise.resolve(null);
    return (await Item.sendAll())[0];
  }
async save ( asBatch = false ) { if ( ! this . isInitialized ) await this . init ( ) ; if ( this . parent ) { if ( this . parent . saved ) { this . data . parentItem = this . parent . data . key ; } else { this . parent . on ( "saved" , key => { this . data . parentItem = key ; this . save ( asBatch ) ; } ) ; return Promise . resolve ( null ) ; } } Item . queue . push ( this ) ; if ( asBatch ) return Promise . resolve ( null ) ; return ( await Item . sendAll ( ) ) [ 0 ] ; }
Saves the item on the Zotero server.
Saves the item on the Zotero server .