# gl-react-dom-static-container

> StaticContainer for gl-react-dom: render the Surface once, snapshot it and release the WebGL context

Latest version **1.1.3** (published 2016-06-18) · MIT license · 0 weekly downloads

## Install

```sh
npm install gl-react-dom-static-container
pnpm add gl-react-dom-static-container
yarn add gl-react-dom-static-container
bun add gl-react-dom-static-container
```

## Health

**Score 15/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.1.3 |
| Published | 2016-06-18 |
| First published | 2015-12-26 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 29 |
| Author | Gaëtan Renaudeau |
| Maintainers | gre |
| Keywords | gl-react, gl-react-dom, static-container, react, react-component |

## Links

- npm: https://www.npmjs.com/package/gl-react-dom-static-container
- Repository: https://github.com/gre/gl-react-dom-static-container
- Homepage: https://github.com/gre/gl-react-dom-static-container#readme
- Issues: https://github.com/gre/gl-react-dom-static-container/issues
- npm.io page: https://npm.io/package/gl-react-dom-static-container

## Dependencies (1)

- [invariant](https://npm.io/package/invariant.md) 2.2.0

## Alternatives

- [mobx-react](https://npm.io/package/mobx-react.md) — 2.8M weekly downloads
- [rc-tree](https://npm.io/package/rc-tree.md) — 2.6M weekly downloads
- [@react-oauth/google](https://npm.io/package/@react-oauth/google.md) — 1.3M weekly downloads
- [@wagmi/connectors](https://npm.io/package/@wagmi/connectors.md) — 877.0K weekly downloads
- [vee-validate](https://npm.io/package/vee-validate.md) — 836.4K weekly downloads

## Recent versions

- 1.1.3 (latest) — 2016-06-18
- 1.1.2 — 2016-02-17
- 1.1.1 — 2016-01-29
- 1.1.0 — 2015-12-27
- 1.0.0 — 2015-12-26

## README

# gl-react-dom-static-container ![](https://img.shields.io/npm/v/gl-react-dom-static-container.svg) ![](https://img.shields.io/badge/gl--react--dom->= 2.0-05F561.svg)

**`<StaticContainer>`** for [gl-react-dom](https://github.com/ProjectSeptemberInc/gl-react-dom): caches WebGL rendering into an `<img>`, free and reuse WebGL contexts. The library schedules the WebGL renderings to limit the maximum concurrent number of running WebGL contexts in order to display a lot of WebGL renderings on the same page.

**without gl-react-dom-static-container:**

![2](https://cloud.githubusercontent.com/assets/211411/12009982/556bb112-ac92-11e5-93cb-748223c1955e.GIF)

> The maximum concurrent instance limit of WebGL can easily be reach if you try to use at least about 20 WebGL canvas running at the same time.

**with gl-react-dom-static-container:**

![1](https://cloud.githubusercontent.com/assets/211411/12009981/55574b1e-ac92-11e5-9bf8-d2e82d5b2104.GIF)

> `gl-react-dom-static-container` solves this problem by: **(1)** caching gl-react rendering into an image and **(2)** preventing a maximum concurrent gl-react-dom's Surface allowed to run at the same time.

## Props

- `children` **required** *(node)*: the `<Surface>` *created with `gl-react-dom`*.
- `maximumConcurrent` *(number)*: limit the maximum concurrent `<Surface>` instance that can run across all StaticContainer's.
- `shouldUpdate` *(bool)*: set to true to make the StaticContainer render the WebGL. If you keep the `shouldUpdate` value to true, the WebGL will continue to render the `<Surface>` (unless `maximumConcurrent` is reached). When `shouldUpdate` is set back to false, and after a `debounceShouldUpdate` duration, the Surface will be captured and cached in an image.
- `debounceShouldUpdate` *(number in ms)*: see `shouldUpdate` prop.
- `timeout` *(number in ms)*: set the time to wait before the first render happens.

## Usage

```js
var GLStaticContainer = require("gl-react-dom-static-container");
// or
import GLStaticContainer from "gl-react-dom-static-container";

...

<GLStaticContainer>
  <Surface ...>
    ...
  </Surface>
</GLStaticContainer>
```

## Full Example

[![](https://cloud.githubusercontent.com/assets/211411/12011455/a2c9b0cc-accd-11e5-83f9-23c253bc7d88.gif)](http://greweb.me/gl-react-dom-static-container/example/)

**(see example/ folder)**

---
_Source: https://npm.io/package/gl-react-dom-static-container · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
