triggerEncoderTranslation (encoder, isEncode) {
    // check if encoder is currently busy
    if (this.getBrickMeta(encoder, 'busy')) {
      // skip translation
      return this
    }

    // update encoder direction
    this.setBrickMeta(encoder, 'direction', isEncode)

    // mark encoder as busy
    this.setBrickMeta(encoder, 'busy', true)

    // collect translation data
    let sourceBucket = this.getBucketIndexForBrick(encoder) + (isEncode ? 0 : 1)
    let source = this.getContent(sourceBucket)
    let settingsVersion = this.getBrickMeta(encoder, 'settingsVersion')

    // trigger translation asynchronously
    new Promise(resolve =>
      setTimeout(() => {
        let result = isEncode
          ? encoder.encode(source)
          : encoder.decode(source)
        resolve(result)
      }, 0))

      .then(result =>
        this.encoderTranslationDidFinish(
          encoder, isEncode, result, source, settingsVersion))

      .catch(() =>
        this.encoderTranslationDidFinish(
          encoder, isEncode, false, source, settingsVersion))

    return this
  }
/**
   * Triggers encoder translation. Keeps track of busy encoders and skips
   * translations accordingly.
   * @protected
   * @param {Encoder} encoder
   * @param {boolean} isEncode True for encoding, false for decoding.
   * @return {Pipe} Fluent interface
   */
Triggers encoder translation. Keeps track of busy encoders and skips
translations accordingly.
@protected
@param {Encoder} encoder
@param {boolean} isEncode True for encoding, false for decoding.
@return {Pipe} Fluent interface
Triggers encoder translation . Keeps track of busy encoders and skips translations accordingly . @protected @param { Encoder } encoder @param { boolean } isEncode True for encoding false for decoding . @return { Pipe } Fluent interface
triggerEncoderTranslation (encoder, isEncode) {
    if (this.getBrickMeta(encoder, 'busy')) {
      return this
    }
    this.setBrickMeta(encoder, 'direction', isEncode)
    this.setBrickMeta(encoder, 'busy', true)
    let sourceBucket = this.getBucketIndexForBrick(encoder) + (isEncode ? 0 : 1)
    let source = this.getContent(sourceBucket)
    let settingsVersion = this.getBrickMeta(encoder, 'settingsVersion')
    new Promise(resolve =>
      setTimeout(() => {
        let result = isEncode
          ? encoder.encode(source)
          : encoder.decode(source)
        resolve(result)
      }, 0))
      .then(result =>
        this.encoderTranslationDidFinish(
          encoder, isEncode, result, source, settingsVersion))
      .catch(() =>
        this.encoderTranslationDidFinish(
          encoder, isEncode, false, source, settingsVersion))
    return this
  }
triggerEncoderTranslation ( encoder , isEncode ) { if ( this . getBrickMeta ( encoder , 'busy' ) ) { return this } this . setBrickMeta ( encoder , 'direction' , isEncode ) this . setBrickMeta ( encoder , 'busy' , true ) let sourceBucket = this . getBucketIndexForBrick ( encoder ) + ( isEncode ? 0 : 1 ) let source = this . getContent ( sourceBucket ) let settingsVersion = this . getBrickMeta ( encoder , 'settingsVersion' ) new Promise ( resolve => setTimeout ( ( ) => { let result = isEncode ? encoder . encode ( source ) : encoder . decode ( source ) resolve ( result ) } , 0 ) ) . then ( result => this . encoderTranslationDidFinish ( encoder , isEncode , result , source , settingsVersion ) ) . catch ( ( ) => this . encoderTranslationDidFinish ( encoder , isEncode , false , source , settingsVersion ) ) return this }
Triggers encoder translation.
Triggers encoder translation .
// check if encoder is currently busy // skip translation // update encoder direction // mark encoder as busy // collect translation data // trigger translation asynchronously