onSelectedDestinationCapabilitiesReady_() {
      const selectedDestination = this.destinationStore_.selectedDestination;
      const isFirstUpdate = this.capabilitiesHolder_.get() == null;
      // Only clear the ticket items if the user selected a new destination
      // and this is not the first update.
      if (!isFirstUpdate && this.destination_ != selectedDestination) {
        this.customMargins_.updateValue(null);
        if (this.marginsType_.getValue() ==
            print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
          this.marginsType_.updateValue(
              print_preview.ticket_items.MarginsTypeValue.DEFAULT);
        }
        this.vendorItems_.updateValue({});
      }
      const caps = assert(selectedDestination.capabilities);
      this.capabilitiesHolder_.set(caps);
      this.destination_ = selectedDestination;
      if (isFirstUpdate) {
        this.isInitialized_ = true;
        cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.INITIALIZE);
      } else {
        cr.dispatchSimpleEvent(
            this, PrintTicketStore.EventType.CAPABILITIES_CHANGE);
      }
    }
/**
     * Called when the capabilities of the selected destination are ready.
     * @private
     */
Called when the capabilities of the selected destination are ready.
@private
Called when the capabilities of the selected destination are ready . @private
onSelectedDestinationCapabilitiesReady_() {
      const selectedDestination = this.destinationStore_.selectedDestination;
      const isFirstUpdate = this.capabilitiesHolder_.get() == null;
      if (!isFirstUpdate && this.destination_ != selectedDestination) {
        this.customMargins_.updateValue(null);
        if (this.marginsType_.getValue() ==
            print_preview.ticket_items.MarginsTypeValue.CUSTOM) {
          this.marginsType_.updateValue(
              print_preview.ticket_items.MarginsTypeValue.DEFAULT);
        }
        this.vendorItems_.updateValue({});
      }
      const caps = assert(selectedDestination.capabilities);
      this.capabilitiesHolder_.set(caps);
      this.destination_ = selectedDestination;
      if (isFirstUpdate) {
        this.isInitialized_ = true;
        cr.dispatchSimpleEvent(this, PrintTicketStore.EventType.INITIALIZE);
      } else {
        cr.dispatchSimpleEvent(
            this, PrintTicketStore.EventType.CAPABILITIES_CHANGE);
      }
    }
onSelectedDestinationCapabilitiesReady_ ( ) { const selectedDestination = this . destinationStore_ . selectedDestination ; const isFirstUpdate = this . capabilitiesHolder_ . get ( ) == null ; if ( ! isFirstUpdate && this . destination_ != selectedDestination ) { this . customMargins_ . updateValue ( null ) ; if ( this . marginsType_ . getValue ( ) == print_preview . ticket_items . MarginsTypeValue . CUSTOM ) { this . marginsType_ . updateValue ( print_preview . ticket_items . MarginsTypeValue . DEFAULT ) ; } this . vendorItems_ . updateValue ( { } ) ; } const caps = assert ( selectedDestination . capabilities ) ; this . capabilitiesHolder_ . set ( caps ) ; this . destination_ = selectedDestination ; if ( isFirstUpdate ) { this . isInitialized_ = true ; cr . dispatchSimpleEvent ( this , PrintTicketStore . EventType . INITIALIZE ) ; } else { cr . dispatchSimpleEvent ( this , PrintTicketStore . EventType . CAPABILITIES_CHANGE ) ; } }
Called when the capabilities of the selected destination are ready.
Called when the capabilities of the selected destination are ready .
// Only clear the ticket items if the user selected a new destination // and this is not the first update.