callbag-share

WebJar for callbag-share

Лицензия

Лицензия

MIT
Группа

Группа

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

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

callbag-share
Последняя версия

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

1.0.2
Дата

Дата

Тип

Тип

jar
Описание

Описание

callbag-share
WebJar for callbag-share
Ссылка на сайт

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

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

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

https://github.com/staltz/callbag-share

Скачать callbag-share

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

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

Зависимости

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

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

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

callbag-share

Callbag operator that broadcasts a single source to multiple sinks. Does reference counting on sinks and starts the source when the first sink gets connected, similar to RxJS .share(). Works on either pullable or listenable sources.

npm install callbag-share

example

Share a listenable source to two listeners:

const interval = require('callbag-interval');
const observe = require('callbag-observe');
const share = require('callbag-share');

const source = share(interval(1000));

observe(x => console.log(x))(source); // 0
                                      // 1
                                      // 2
                                      // 3
                                      // ...

setTimeout(() => {
  observe(x => console.log(x))(source); // 3
                                        // 4
                                        // 5
                                        // ...
}, 3500);

Share a pullable source to two pullers:

const fromIter = require('callbag-from-iter');
const share = require('callbag-share');

const source = share(fromIter([10,20,30,40,50]));

let talkback;
source(0, (type, data) => {
  if (type === 0) talkback = data;
  else console.log('a' + data);
});

source(0, (type, data) => {
  if (type === 1) console.log('b' + data);
});

talkback(1); // a10
             // b10
talkback(1); // a20
             // b20

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

Версия
1.0.2