index.js
function constructor(options) {
    Pagelet.prototype.constructor.call(this, options = options || {});

    //
    // Store the provided global dependencies.
    //
    this.dependencies = this._bigpipe._compiler.page(this).concat(
      options.dependencies
    );

    var req = options.req || {}
      , uri = req.uri || {}
      , query = req.query || {};

    //
    // Set a number of properties on the response as it is available to all pagelets.
    // This will ensure the correct amount of pagelets are processed and that the
    // entire queue is written to the client.
    //
    this._queue = [];

    //
    // Prepare several properties that are used to render the HTML fragment.
    //
    this.length = options.length || 0;
    this.child = options.child || 'root';
    this.once('contentType', this.contentTypeHeader, this);

    //
    // Set the default fallback script, see explanation above.
    //
    this.debug('Initialized in %s mode', options.mode);
    this.fallback = 'sync' === options.mode ? script : noscript.replace(
      '{path}',
      uri.pathname || 'http://localhost/'
    ).replace(
      '{query}',
      qs.stringify(this.merge({ no_pagelet_js: 1 }, query))
    );
  }
function constructor(options) {
    Pagelet.prototype.constructor.call(this, options = options || {});

    //
    // Store the provided global dependencies.
    //
    this.dependencies = this._bigpipe._compiler.page(this).concat(
      options.dependencies
    );

    var req = options.req || {}
      , uri = req.uri || {}
      , query = req.query || {};

    //
    // Set a number of properties on the response as it is available to all pagelets.
    // This will ensure the correct amount of pagelets are processed and that the
    // entire queue is written to the client.
    //
    this._queue = [];

    //
    // Prepare several properties that are used to render the HTML fragment.
    //
    this.length = options.length || 0;
    this.child = options.child || 'root';
    this.once('contentType', this.contentTypeHeader, this);

    //
    // Set the default fallback script, see explanation above.
    //
    this.debug('Initialized in %s mode', options.mode);
    this.fallback = 'sync' === options.mode ? script : noscript.replace(
      '{path}',
      uri.pathname || 'http://localhost/'
    ).replace(
      '{query}',
      qs.stringify(this.merge({ no_pagelet_js: 1 }, query))
    );
  }
function constructor ( options ) { Pagelet . prototype . constructor . call ( this , options = options || { } ) ; // // Store the provided global dependencies. // this . dependencies = this . _bigpipe . _compiler . page ( this ) . concat ( options . dependencies ) ; var req = options . req || { } , uri = req . uri || { } , query = req . query || { } ; // // Set a number of properties on the response as it is available to all pagelets. // This will ensure the correct amount of pagelets are processed and that the // entire queue is written to the client. // this . _queue = [ ] ; // // Prepare several properties that are used to render the HTML fragment. // this . length = options . length || 0 ; this . child = options . child || 'root' ; this . once ( 'contentType' , this . contentTypeHeader , this ) ; // // Set the default fallback script, see explanation above. // this . debug ( 'Initialized in %s mode' , options . mode ) ; this . fallback = 'sync' === options . mode ? script : noscript . replace ( '{path}' , uri . pathname || 'http://localhost/' ) . replace ( '{query}' , qs . stringify ( this . merge ( { no_pagelet_js : 1 } , query ) ) ) ; }
Extend the default constructor of the pagelet to set additional defaults
based on the provided options.

@param {Object} options Optional options.
@api public
Extend the default constructor of the pagelet to set additional defaults based on the provided options .