build/tincan.js
function TextEncoder(label, options) {
    // Web IDL conventions
    if (!(this instanceof TextEncoder))
      throw TypeError('Called as a function. Did you forget \'new\'?');
    options = ToDictionary(options);

    // A TextEncoder object has an associated encoding and encoder.

    /** @private */
    this._encoding = null;
    /** @private @type {?Encoder} */
    this._encoder = null;

    // Non-standard
    /** @private @type {boolean} */
    this._do_not_flush = false;
    /** @private @type {string} */
    this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';

    // 1. Let enc be a new TextEncoder object.
    var enc = this;

    // 2. Set enc's encoding to UTF-8's encoder.
    if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {
      // NONSTANDARD behavior.
      label = label !== undefined ? String(label) : DEFAULT_ENCODING;
      var encoding = getEncoding(label);
      if (encoding === null || encoding.name === 'replacement')
        throw RangeError('Unknown encoding: ' + label);
      if (!encoders[encoding.name]) {
        throw Error('Encoder not present.' +
                    ' Did you forget to include encoding-indexes.js?');
      }
      enc._encoding = encoding;
    } else {
      // Standard behavior.
      enc._encoding = getEncoding('utf-8');

      if (label !== undefined && 'console' in global) {
        console.warn('TextEncoder constructor called with encoding label, '
                     + 'which is ignored.');
      }
    }

    // For pre-ES5 runtimes:
    if (!Object.defineProperty)
      this.encoding = enc._encoding.name.toLowerCase();

    // 3. Return enc.
    return enc;
  }
function TextEncoder(label, options) {
    // Web IDL conventions
    if (!(this instanceof TextEncoder))
      throw TypeError('Called as a function. Did you forget \'new\'?');
    options = ToDictionary(options);

    // A TextEncoder object has an associated encoding and encoder.

    /** @private */
    this._encoding = null;
    /** @private @type {?Encoder} */
    this._encoder = null;

    // Non-standard
    /** @private @type {boolean} */
    this._do_not_flush = false;
    /** @private @type {string} */
    this._fatal = Boolean(options['fatal']) ? 'fatal' : 'replacement';

    // 1. Let enc be a new TextEncoder object.
    var enc = this;

    // 2. Set enc's encoding to UTF-8's encoder.
    if (Boolean(options['NONSTANDARD_allowLegacyEncoding'])) {
      // NONSTANDARD behavior.
      label = label !== undefined ? String(label) : DEFAULT_ENCODING;
      var encoding = getEncoding(label);
      if (encoding === null || encoding.name === 'replacement')
        throw RangeError('Unknown encoding: ' + label);
      if (!encoders[encoding.name]) {
        throw Error('Encoder not present.' +
                    ' Did you forget to include encoding-indexes.js?');
      }
      enc._encoding = encoding;
    } else {
      // Standard behavior.
      enc._encoding = getEncoding('utf-8');

      if (label !== undefined && 'console' in global) {
        console.warn('TextEncoder constructor called with encoding label, '
                     + 'which is ignored.');
      }
    }

    // For pre-ES5 runtimes:
    if (!Object.defineProperty)
      this.encoding = enc._encoding.name.toLowerCase();

    // 3. Return enc.
    return enc;
  }
function TextEncoder ( label , options ) { // Web IDL conventions if ( ! ( this instanceof TextEncoder ) ) throw TypeError ( 'Called as a function. Did you forget \'new\'?' ) ; options = ToDictionary ( options ) ; // A TextEncoder object has an associated encoding and encoder. /** @private */ this . _encoding = null ; /** @private @type {?Encoder} */ this . _encoder = null ; // Non-standard /** @private @type {boolean} */ this . _do_not_flush = false ; /** @private @type {string} */ this . _fatal = Boolean ( options [ 'fatal' ] ) ? 'fatal' : 'replacement' ; // 1. Let enc be a new TextEncoder object. var enc = this ; // 2. Set enc's encoding to UTF-8's encoder. if ( Boolean ( options [ 'NONSTANDARD_allowLegacyEncoding' ] ) ) { // NONSTANDARD behavior. label = label !== undefined ? String ( label ) : DEFAULT_ENCODING ; var encoding = getEncoding ( label ) ; if ( encoding === null || encoding . name === 'replacement' ) throw RangeError ( 'Unknown encoding: ' + label ) ; if ( ! encoders [ encoding . name ] ) { throw Error ( 'Encoder not present.' + ' Did you forget to include encoding-indexes.js?' ) ; } enc . _encoding = encoding ; } else { // Standard behavior. enc . _encoding = getEncoding ( 'utf-8' ) ; if ( label !== undefined && 'console' in global ) { console . warn ( 'TextEncoder constructor called with encoding label, ' + 'which is ignored.' ) ; } } // For pre-ES5 runtimes: if ( ! Object . defineProperty ) this . encoding = enc . _encoding . name . toLowerCase ( ) ; // 3. Return enc. return enc ; }
8.2 Interface TextEncoder 
@constructor
@param {string=} label The label of the encoding. NONSTANDARD.
@param {Object=} options NONSTANDARD.
8 . 2 Interface TextEncoder