mostjs-community/proxy
Circular dependencies for most.
{ "createdAt": "2016-04-01T07:41:44Z", "defaultBranch": "master", "description": "Circular dependencies for most.", "fullName": "mostjs-community/proxy", "homepage": null, "language": "TypeScript", "name": "proxy", "pushedAt": "2017-10-24T20:17:55Z", "stargazersCount": 20, "topics": [], "updatedAt": "2022-03-14T00:59:25Z", "url": "https://github.com/mostjs-community/proxy"}Most Proxy
Section titled “Most Proxy”Create circular stream dependencies that is declarative and designed to avoid memory leaks.
This codebase is proudly written in TypeScript so you can enjoy beautiful typings.
Compatibility
Section titled “Compatibility”This library is compatible with cujojs/most v1.x. For @most/core support this library has been merged with most-subject.
Install
Section titled “Install”npm install --save most-proxyExample
Section titled “Example”import { periodic } from 'most'import { proxy } from 'most-proxy'
// create a proxy// returns *attach* to attach proxy to another stream, and a proxy stream *stream*const { attach, stream } = proxy()
// observe the proxy, taking only three events// proxy is a real most.Stream// when stream ends, original will also be disposed of internallystream.take(3).observe(x => console.log(x)) // 1, 2, 3
// here we create the stream we want to use as the circular dependencyconst original = periodic(100, 1).scan((x, y) => x + y, 0)
// pipe events from original to proxy streamattach(original)API Documentation
Section titled “API Documentation”interface Proxy<T> { attach(stream: Stream<T>): Stream<T>;
stream: Stream<T>;}