requestPreview() {
      if (!this.printTicketStore_.isTicketValidForPreview() ||
          !this.printTicketStore_.isInitialized ||
          !this.destinationStore_.selectedDestination) {
        return {id: -1, request: null};
      }
      const previewChanged = this.hasPreviewChanged_();
      if (!previewChanged && !this.hasPreviewPageRangeChanged_()) {
        // Changes to these ticket items might not trigger a new preview, but
        // they still need to be recorded.
        this.marginsType_ = this.printTicketStore_.marginsType.getValue();
        return {id: -1, request: null};
      }
      this.mediaSize_ = this.printTicketStore_.mediaSize.getValue();
      this.isLandscapeEnabled_ = this.printTicketStore_.landscape.getValue();
      this.isHeaderFooterEnabled_ =
          this.printTicketStore_.headerFooter.getValue();
      this.colorValue_ = this.printTicketStore_.color.getValue();
      this.isFitToPageEnabled_ = this.printTicketStore_.fitToPage.getValue();
      this.rasterize_ = this.printTicketStore_.rasterize.getValue();
      this.scalingValue_ = this.printTicketStore_.scaling.getValueAsNumber();
      this.pageRanges_ = this.printTicketStore_.pageRange.getPageRanges();
      this.marginsType_ = this.printTicketStore_.marginsType.getValue();
      this.isCssBackgroundEnabled_ =
          this.printTicketStore_.cssBackground.getValue();
      this.isSelectionOnlyEnabled_ =
          this.printTicketStore_.selectionOnly.getValue();
      this.selectedDestination_ = this.destinationStore_.selectedDestination;

      this.inFlightRequestId_++;
      return {
        id: this.inFlightRequestId_,
        request: this.getPreview_(),
      };
    }
/**
     * Request that new preview be generated. A preview request will not be
     * generated if the print ticket has not changed sufficiently.
     * @return {{id: number,
     *           request: Promise}} The preview request id, or -1 if no preview
     *     was requested, and a promise that will resolve when the preview is
     *     complete (null if no preview was actually requested).
     */
Request that new preview be generated. A preview request will not be
generated if the print ticket has not changed sufficiently.
@return {{id: number,
request: Promise}} The preview request id, or -1 if no preview
was requested, and a promise that will resolve when the preview is
complete (null if no preview was actually requested).
Request that new preview be generated . A preview request will not be generated if the print ticket has not changed sufficiently . @return {{ id : number request : Promise }} The preview request id or - 1 if no preview was requested and a promise that will resolve when the preview is complete ( null if no preview was actually requested ) .
requestPreview() {
      if (!this.printTicketStore_.isTicketValidForPreview() ||
          !this.printTicketStore_.isInitialized ||
          !this.destinationStore_.selectedDestination) {
        return {id: -1, request: null};
      }
      const previewChanged = this.hasPreviewChanged_();
      if (!previewChanged && !this.hasPreviewPageRangeChanged_()) {
        this.marginsType_ = this.printTicketStore_.marginsType.getValue();
        return {id: -1, request: null};
      }
      this.mediaSize_ = this.printTicketStore_.mediaSize.getValue();
      this.isLandscapeEnabled_ = this.printTicketStore_.landscape.getValue();
      this.isHeaderFooterEnabled_ =
          this.printTicketStore_.headerFooter.getValue();
      this.colorValue_ = this.printTicketStore_.color.getValue();
      this.isFitToPageEnabled_ = this.printTicketStore_.fitToPage.getValue();
      this.rasterize_ = this.printTicketStore_.rasterize.getValue();
      this.scalingValue_ = this.printTicketStore_.scaling.getValueAsNumber();
      this.pageRanges_ = this.printTicketStore_.pageRange.getPageRanges();
      this.marginsType_ = this.printTicketStore_.marginsType.getValue();
      this.isCssBackgroundEnabled_ =
          this.printTicketStore_.cssBackground.getValue();
      this.isSelectionOnlyEnabled_ =
          this.printTicketStore_.selectionOnly.getValue();
      this.selectedDestination_ = this.destinationStore_.selectedDestination;
      this.inFlightRequestId_++;
      return {
        id: this.inFlightRequestId_,
        request: this.getPreview_(),
      };
    }
requestPreview ( ) { if ( ! this . printTicketStore_ . isTicketValidForPreview ( ) || ! this . printTicketStore_ . isInitialized || ! this . destinationStore_ . selectedDestination ) { return { id : - 1 , request : null } ; } const previewChanged = this . hasPreviewChanged_ ( ) ; if ( ! previewChanged && ! this . hasPreviewPageRangeChanged_ ( ) ) { this . marginsType_ = this . printTicketStore_ . marginsType . getValue ( ) ; return { id : - 1 , request : null } ; } this . mediaSize_ = this . printTicketStore_ . mediaSize . getValue ( ) ; this . isLandscapeEnabled_ = this . printTicketStore_ . landscape . getValue ( ) ; this . isHeaderFooterEnabled_ = this . printTicketStore_ . headerFooter . getValue ( ) ; this . colorValue_ = this . printTicketStore_ . color . getValue ( ) ; this . isFitToPageEnabled_ = this . printTicketStore_ . fitToPage . getValue ( ) ; this . rasterize_ = this . printTicketStore_ . rasterize . getValue ( ) ; this . scalingValue_ = this . printTicketStore_ . scaling . getValueAsNumber ( ) ; this . pageRanges_ = this . printTicketStore_ . pageRange . getPageRanges ( ) ; this . marginsType_ = this . printTicketStore_ . marginsType . getValue ( ) ; this . isCssBackgroundEnabled_ = this . printTicketStore_ . cssBackground . getValue ( ) ; this . isSelectionOnlyEnabled_ = this . printTicketStore_ . selectionOnly . getValue ( ) ; this . selectedDestination_ = this . destinationStore_ . selectedDestination ; this . inFlightRequestId_ ++ ; return { id : this . inFlightRequestId_ , request : this . getPreview_ ( ) , } ; }
Request that new preview be generated.
Request that new preview be generated .
// Changes to these ticket items might not trigger a new preview, but // they still need to be recorded.