Files
owncast/build/javascript/node_modules/individual/README.md
dependabot[bot] dab7914eab Bump @justinribeiro/lite-youtube from 0.9.0 to 0.9.1 in /build/javascript (#273)
* Commit updated Javascript packages

* Bump preact from 10.5.4 to 10.5.5 in /build/javascript (#265)

* Trying a new github workflow to install javascript packages

* Bump tailwindcss from 1.9.2 to 1.9.4 in /build/javascript (#266)

Bumps [tailwindcss](https://github.com/tailwindlabs/tailwindcss) from 1.9.2 to 1.9.4.
- [Release notes](https://github.com/tailwindlabs/tailwindcss/releases)
- [Changelog](https://github.com/tailwindlabs/tailwindcss/blob/master/CHANGELOG.md)
- [Commits](https://github.com/tailwindlabs/tailwindcss/compare/v1.9.2...v1.9.4)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>

* Commit updated Javascript packages

* Bump preact from 10.5.4 to 10.5.5 in /build/javascript

Bumps [preact](https://github.com/preactjs/preact) from 10.5.4 to 10.5.5.
- [Release notes](https://github.com/preactjs/preact/releases)
- [Commits](https://github.com/preactjs/preact/compare/10.5.4...10.5.5)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Gabe Kangas <gabek@real-ity.com>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Owncast <owncast@owncast.online>

* Bump @justinribeiro/lite-youtube in /build/javascript

Bumps [@justinribeiro/lite-youtube](https://github.com/justinribeiro/lite-youtube) from 0.9.0 to 0.9.1.
- [Release notes](https://github.com/justinribeiro/lite-youtube/releases)
- [Commits](https://github.com/justinribeiro/lite-youtube/commits)

Signed-off-by: dependabot[bot] <support@github.com>

Co-authored-by: Owncast <owncast@owncast.online>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Gabe Kangas <gabek@real-ity.com>
2020-10-20 15:15:56 -07:00

70 lines
2.0 KiB
Markdown

# individual
[![build status][build-png]][build] [![Coverage Status][cover-png]][cover] [![Davis Dependency status][dep-png]][dep]
[![NPM][npm-png]][npm]
[![browser support][test-png]][test]
Garantueed individual values
## Example
```js
var Individual = require("individual")
var moduleCache = Individual("__MY_MODULE_CACHE", {})
// moduleCache is a individual variable local to this file.
// It will always be the same value and defaults to {}.
```
This gives you a singleton value by a unique name (it stores it
as a global variable).
## Use cases
Your module has an internal cache. If your module is loaded
twice, (someone didn't npm dedup and has two copies of your
module) you would have two seperate caches that dont talk
to each other.
Best case your cache is less efficient. Worst case you have a
cache because the native C++ extension you talk to crashes
if you instantiate something twice.
You need a garantuee that this value is an individual, there is
only one of it.
I use it myself because opening a SockJS websocket to the same
URI twice causes an infinite loop. I need a garantuee that
I have an individual value for the SockJS connection so I
can see whether I already have an open connection.
## WHY GLOBALS >:(
I can't imagine any other way to do it. I hate it too. Make a
pull request if you know the real solution
## Installation
`npm install individual`
## Contributors
- Raynos
## MIT Licenced
[build-png]: https://secure.travis-ci.org/Raynos/individual.png
[build]: https://travis-ci.org/Raynos/individual
[cover-png]: https://coveralls.io/repos/Raynos/individual/badge.png
[cover]: https://coveralls.io/r/Raynos/individual
[dep-png]: https://david-dm.org/Raynos/individual.png
[dep]: https://david-dm.org/Raynos/individual
[test-png]: https://ci.testling.com/Raynos/individual.png
[test]: https://ci.testling.com/Raynos/individual
[npm-png]: https://nodei.co/npm/individual.png?stars&downloads
[npm]: https://nodei.co/npm/individual