<commit_before># Pipe

`Pipe` is the client side component for the [BigPipe] framework. It orchestrates
the arrival of [pagelet]'s on the page, loads all assets and setup the real-time
connections. It's the glue between the server and your own client code. While
this library is highly opinionated and developed against the features that are
provided in [BigPipe] we made sure that every piece of code is re-usable by the
community. We've extracted various of components out of this library and
released them as separate projects:

- **[frames]**: A small function for creating and managing iframes in the DOM.
- **[containerization]**: Containerization for front-end code.
- **[alcatraz]**: Wraps and prepares front-end code for containerization.
- **[fortress]**: The Docker of front-end applications. It provides a
  docker like API for controlling the containerization process of multiple
  snippets of code.

## Installation

The code is released through npm, but it doesn't work in Node.js. We merely use
it for dependency management.

```
npm install --save pipe.js
```

We assume that this code is loaded in an environment that has [primus] and it's
[substream] plugin loaded.

## Table of Contents

**BigPipe instance**
- [Configuration](#bigpipe-configuration)
- [Events](#bigpipe-events)
- [BigPipe.arrive](#bigpipearrive)
- [BigPipe.has](#bigpipehas)
- [BigPipe.remove](#bigpiperemove)
- [BigPipe.broadcast](#bigpipebroadcast)

**Pagelet instance**
- [Configuration](#pagelet-configuration);
- [Events](#pagelet-events);

### BigPipe: Configuration

The code introduced to the page as an **`BigPipe`** global. The `BigPipe`
constructor accepts 2 arguments:

1. Location of your BigPipe server. If nothing is provided it assumes that you
   want to connect to the current domain.
2. Configuration or options of the BigPipe instance.

The following options are accepted:

- **limit**: The amount of Pagelets instances we can re-use to reduce garbage
  collections. Defaults to `20`
- **pagelets**: The amount of Pagelets we expect to be loaded on the page. This
  is used to determine the loading/progress of the page.
- **id**: The `id` of the Page that we're loading.

In addition to the options listed above, all options that can be used to
configure [primus] are also supported as this options object is directly passed
to the Primus constructor. The only Primus option that is forced by us is the
**manual** option. As we need to be in control of the opening of the real-time
connection.

```js<commit_msg>[doc] Updated TOC<commit_after># Pipe

`Pipe` is the client side component for the [BigPipe] framework. It orchestrates
the arrival of [pagelet]'s on the page, loads all assets and setup the real-time
connections. It's the glue between the server and your own client code. While
this library is highly opinionated and developed against the features that are
provided in [BigPipe] we made sure that every piece of code is re-usable by the
community. We've extracted various of components out of this library and
released them as separate projects:

- **[frames]**: A small function for creating and managing iframes in the DOM.
- **[containerization]**: Containerization for front-end code.
- **[alcatraz]**: Wraps and prepares front-end code for containerization.
- **[fortress]**: The Docker of front-end applications. It provides a
  docker like API for controlling the containerization process of multiple
  snippets of code.

## Installation

The code is released through npm, but it doesn't work in Node.js. We merely use
it for dependency management.

```
npm install --save pipe.js
```

We assume that this code is loaded in an environment that has [primus] and it's
[substream] plugin loaded.

## Table of Contents

**BigPipe instance**
- [Configuration](#bigpipe-configuration)
- [Events](#bigpipe-events)
- [BigPipe.arrive()](#bigpipearrive)
- [BigPipe.has()](#bigpipehas)
- [BigPipe.remove()](#bigpiperemove)
- [BigPipe.broadcast()](#bigpipebroadcast)

**Pagelet instance**
- [Configuration](#pagelet-configuration)
- [Events](#pagelet-events)
- [Pagelet.name](#pageletname)
- [Pagelet.id](#pageletid)
- [Pagelet.placeholders](#pageletplaceholders)
- [Pagelet.destroy()](#pageletdestroy)
- [Pagelet.submit()](#pageletsubmit)
- [Pagelet.get()](#pageletget)
- [Pagelet.broadcast()](#pageletbroadcast)
- [Pagelet.$()](#pagelet)
- [Pagelet.render()](#pageletrender)
- [Pagelet.parse()](#pageletparse)
- [Pagelet.listen()](#pageletlisten)
- [Pagelet.processor()](#pageletprocessor)

### BigPipe: Configuration

The code introduced to the page as an **`BigPipe`** global. The `BigPipe`
constructor accepts 2 arguments:

1. Location of your BigPipe server. If nothing is provided it assumes that you
   want to connect to the current domain.
2. Configuration or options of the BigPipe instance.

The following options are accepted:

- **limit**: The amount of Pagelets instances we can re-use to reduce garbage
  collections. Defaults to `20`
- **pagelets**: The amount of Pagelets we expect to be loaded on the page. This
  is used to determine the loading/progress of the page.
- **id**: The `id` of the Page that we're loading.

In addition to the options listed above, all options that can be used to
configure [primus] are also supported as this options object is directly passed
to the Primus constructor. The only Primus option that is forced by us is the
**manual** option. As we need to be in control of the opening of the real-time
connection.

```js
{'fraction_non_alphanumeric': 0.09899726526891522, 'fraction_numerical': 0.0018231540565177757, 'mean_word_length': 4.744502617801047, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5225547', 'n_tokens_mistral': 1597, 'n_tokens_neox': 1503, 'n_words': 705}