diff --git a/npmextra.json b/npmextra.json index 9e42f24..e74c2bf 100644 --- a/npmextra.json +++ b/npmextra.json @@ -12,12 +12,22 @@ "githost": "code.foss.global", "gitscope": "push.rocks", "gitrepo": "smartrx", - "description": "smart wrapper for rxjs", + "description": "A smart wrapper for rxjs to manage and extend observables.", "npmPackagename": "@push.rocks/smartrx", - "license": "MIT" + "license": "MIT", + "keywords": [ + "rxjs", + "wrapper", + "observables", + "event emitter", + "stream processing", + "reactive programming", + "backpressure", + "event handling" + ] } }, - "tsdocs": { + "tsdoc": { "legal": "\n## License and Legal Information\n\nThis repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. \n\n**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file.\n\n### Trademarks\n\nThis project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH.\n\n### Company Information\n\nTask Venture Capital GmbH \nRegistered at District court Bremen HRB 35230 HB, Germany\n\nFor any legal inquiries or if you require further information, please contact us via email at hello@task.vc.\n\nBy using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.\n" } } \ No newline at end of file diff --git a/package.json b/package.json index 7e702f8..d683ae9 100644 --- a/package.json +++ b/package.json @@ -2,7 +2,7 @@ "name": "@push.rocks/smartrx", "version": "3.0.8", "private": false, - "description": "smart wrapper for rxjs", + "description": "A smart wrapper for rxjs to manage and extend observables.", "main": "dist_ts/index.js", "typings": "dist_ts/index.d.ts", "type": "module", @@ -39,5 +39,15 @@ ], "browserslist": [ "last 1 chrome versions" + ], + "keywords": [ + "rxjs", + "wrapper", + "observables", + "event emitter", + "stream processing", + "reactive programming", + "backpressure", + "event handling" ] -} +} \ No newline at end of file diff --git a/readme.hints.md b/readme.hints.md new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/readme.hints.md @@ -0,0 +1 @@ + \ No newline at end of file diff --git a/readme.md b/readme.md index 504e21f..b4deb93 100644 --- a/readme.md +++ b/readme.md @@ -1,37 +1,120 @@ # @push.rocks/smartrx + smart wrapper for rxjs -## Availabililty and Links -* [npmjs.org (npm package)](https://www.npmjs.com/package/@push.rocks/smartrx) -* [gitlab.com (source)](https://gitlab.com/push.rocks/smartrx) -* [github.com (source mirror)](https://github.com/push.rocks/smartrx) -* [docs (typedoc)](https://push.rocks.gitlab.io/smartrx/) +## Install -## Status for master +To install `@push.rocks/smartrx`, run the following command in your terminal: -Status Category | Status Badge --- | -- -GitLab Pipelines | [![pipeline status](https://gitlab.com/push.rocks/smartrx/badges/master/pipeline.svg)](https://lossless.cloud) -GitLab Pipline Test Coverage | [![coverage report](https://gitlab.com/push.rocks/smartrx/badges/master/coverage.svg)](https://lossless.cloud) -npm | [![npm downloads per month](https://badgen.net/npm/dy/@push.rocks/smartrx)](https://lossless.cloud) -Snyk | [![Known Vulnerabilities](https://badgen.net/snyk/push.rocks/smartrx)](https://lossless.cloud) -TypeScript Support | [![TypeScript](https://badgen.net/badge/TypeScript/>=%203.x/blue?icon=typescript)](https://lossless.cloud) -node Support | [![node](https://img.shields.io/badge/node->=%2010.x.x-blue.svg)](https://nodejs.org/dist/latest-v10.x/docs/api/) -Code Style | [![Code Style](https://badgen.net/badge/style/prettier/purple)](https://lossless.cloud) -PackagePhobia (total standalone install weight) | [![PackagePhobia](https://badgen.net/packagephobia/install/@push.rocks/smartrx)](https://lossless.cloud) -PackagePhobia (package size on registry) | [![PackagePhobia](https://badgen.net/packagephobia/publish/@push.rocks/smartrx)](https://lossless.cloud) -BundlePhobia (total size when bundled) | [![BundlePhobia](https://badgen.net/bundlephobia/minzip/@push.rocks/smartrx)](https://lossless.cloud) +```bash +npm install @push.rocks/smartrx --save +``` + +This package is distributed via npm and should be saved as a dependency in your project's `package.json` file once installed. ## Usage -Use TypeScript for best in class instellisense. +`@push.rocks/smartrx` provides a smart wrapper for working with RxJS, enhancing its already powerful reactive programming capabilities with additional functionalities, including easier observable map management and observable intake handling. We'll explore key features and how to use them in TypeScript. -## Contribution +First, ensure you're working in an environment configured for TypeScript and modern JavaScript development. -We are always happy for code contributions. If you are not the code contributing type that is ok. Still, maintaining Open Source repositories takes considerable time and thought. If you like the quality of what we do and our modules are useful to you we would appreciate a little monthly contribution: You can [contribute one time](https://lossless.link/contribute-onetime) or [contribute monthly](https://lossless.link/contribute). :) +### Basic Setup -For further information read the linked docs at the top of this readme. +To start using `@push.rocks/smartrx`, first, import what you need from the package: -## Legal -> MIT licensed | **©** [Task Venture Capital GmbH](https://task.vc) -| By using this npm module you agree to our [privacy policy](https://lossless.gmbH/privacy) +```typescript +import { Observablemap, ObservableIntake, rxjs } from '@push.rocks/smartrx'; +``` + +### Observable Map Management + +`Observablemap` helps manage observables efficiently, especially useful when you need to ensure a single observable per event or when working with event emitters. + +#### Basic Observablemap Use + +```typescript +import { Observablemap } from '@push.rocks/smartrx'; +import { EventEmitter } from 'events'; + +// Initialize Observablemap +const observableMap = new Observablemap(); + +// Your event emitter (node.js events in this case) +const myEmitter = new EventEmitter(); + +// Get a Subject for a specific event +const myEventSubject = observableMap.getSubjectForEmitterEvent(myEmitter, 'myEvent'); + +// Subscribe to the Subject +myEventSubject.subscribe({ + next: (value) => console.log(`Received value: ${value}`), +}); + +// Emit events +myEmitter.emit('myEvent', 'Hello World!'); +``` + +This approach ensures that you have a single observable (Subject in this case) per event, efficiently reusing existing observables instead of creating new ones for the same event. + +### Observable Intake + +`ObservableIntake` is designed for efficiently managing and controlling the flow of data through observables, offering features like buffering and intake requests. + +#### Using ObservableIntake + +```typescript +import { ObservableIntake } from '@push.rocks/smartrx'; + +// Initialize ObservableIntake +const observableIntake = new ObservableIntake(); + +// Listen to the observableIntake as you would with any RxJS Observable +observableIntake.subscribe({ + next: (message) => console.log(message), + complete: () => console.log('No more messages'), +}); + +// Push messages into the observable intake +observableIntake.push('Hello'); +observableIntake.push('World'); + +// Signal completion +observableIntake.signalComplete(); +``` + +`ObservableIntake` offers the flexibility of adding values as they come and controlling when those values are emitted to subscribers, including buffering capabilities for managing backpressure. + + +#### Advanced Use-cases + +`@push.rocks/smartrx` is built to handle more sophisticated scenarios like working with streams or handling events in a web environment. + +- **From Streams with Backpressure**: Efficiently create observables from Node.js streams, applying backpressure as needed. +- **Event Management in Browsers**: Easily map browser events to observables, enabling reactive programming principles in frontend development. + +### Conclusion + +`@push.rocks/smartrx` significantly simplifies some of the more tedious aspects of working with RxJS, making it easier to manage observables related to event emitters and providing helpful utilities like observable intake for controlling data flow. With its smart wrappers, developers can focus more on business logic rather than boilerplate code for observable management. + +For more complex use cases, such as integrating with external data sources or managing complex state with Redux, `@push.rocks/smartrx` offers a solid foundation for building reactive applications with ease and efficiency. + +Remember, reactive programming with RxJS is a powerful paradigm that can make handling asynchronous data streams simpler and more maintainable. `@push.rocks/smartrx` enhances this paradigm by providing tools that make working with RxJS even more pleasant and productive. + +## License and Legal Information + +This repository contains open-source code that is licensed under the MIT License. A copy of the MIT License can be found in the [license](license) file within this repository. + +**Please note:** The MIT License does not grant permission to use the trade names, trademarks, service marks, or product names of the project, except as required for reasonable and customary use in describing the origin of the work and reproducing the content of the NOTICE file. + +### Trademarks + +This project is owned and maintained by Task Venture Capital GmbH. The names and logos associated with Task Venture Capital GmbH and any related products or services are trademarks of Task Venture Capital GmbH and are not included within the scope of the MIT license granted herein. Use of these trademarks must comply with Task Venture Capital GmbH's Trademark Guidelines, and any usage must be approved in writing by Task Venture Capital GmbH. + +### Company Information + +Task Venture Capital GmbH +Registered at District court Bremen HRB 35230 HB, Germany + +For any legal inquiries or if you require further information, please contact us via email at hello@task.vc. + +By using this repository, you acknowledge that you have read this section, agree to comply with its terms, and understand that the licensing of the code does not imply endorsement by Task Venture Capital GmbH of any derivative works.