individual

WebJar for individual

Лицензия

Лицензия

MIT
Группа

Группа

org.webjars.bowergithub.raynos
Идентификатор

Идентификатор

individual
Последняя версия

Последняя версия

2.0.0
Дата

Дата

Тип

Тип

jar
Описание

Описание

individual
WebJar for individual
Ссылка на сайт

Ссылка на сайт

http://webjars.org
Система контроля версий

Система контроля версий

https://github.com/Raynos/individual

Скачать individual

Как подключить последнюю версию

<!-- https://jarcasting.com/artifacts/org.webjars.bowergithub.raynos/individual/ -->
<dependency>
    <groupId>org.webjars.bowergithub.raynos</groupId>
    <artifactId>individual</artifactId>
    <version>2.0.0</version>
</dependency>
// https://jarcasting.com/artifacts/org.webjars.bowergithub.raynos/individual/
implementation 'org.webjars.bowergithub.raynos:individual:2.0.0'
// https://jarcasting.com/artifacts/org.webjars.bowergithub.raynos/individual/
implementation ("org.webjars.bowergithub.raynos:individual:2.0.0")
'org.webjars.bowergithub.raynos:individual:jar:2.0.0'
<dependency org="org.webjars.bowergithub.raynos" name="individual" rev="2.0.0">
  <artifact name="individual" type="jar" />
</dependency>
@Grapes(
@Grab(group='org.webjars.bowergithub.raynos', module='individual', version='2.0.0')
)
libraryDependencies += "org.webjars.bowergithub.raynos" % "individual" % "2.0.0"
[org.webjars.bowergithub.raynos/individual "2.0.0"]

Зависимости

Библиотека не имеет зависимостей. Это самодостаточное приложение, которое не зависит ни от каких других библиотек.

Модули Проекта

Данный проект не имеет модулей.

individual

build status Coverage Status Davis Dependency status

NPM

browser support

Garantueed individual values

Example

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

Версии библиотеки

Версия
2.0.0