New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@rx-signals/angular-provider

Package Overview
Dependencies
Maintainers
1
Versions
15
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@rx-signals/angular-provider - npm Package Compare versions

Comparing version 3.0.0-rc5 to 3.0.0-rc6

lib/rx-signals-store.module.d.ts.map

1

index.d.ts

@@ -6,1 +6,2 @@ /**

export * from './public-api';
//# sourceMappingURL=rx-signals-angular-provider.d.ts.map
import { EnvironmentProviders, ModuleWithProviders } from '@angular/core';
import { Store } from '@rx-signals/store';
import * as i0 from "@angular/core";
export declare type SetupWithStore = (store: Store) => void;
/**
* The argument type for store providers
*/
export type SetupWithStore = (store: Store) => void;
export declare class RxSignalsStoreModule {

@@ -43,1 +46,2 @@ /**

export declare const provideChildStore: (...setups: SetupWithStore[]) => EnvironmentProviders;
//# sourceMappingURL=rx-signals-store.module.d.ts.map

2

package.json
{
"name": "@rx-signals/angular-provider",
"version": "3.0.0-rc5",
"version": "3.0.0-rc6",
"description": "Angular provider for @rx-signals/store",

@@ -5,0 +5,0 @@ "author": "Gerd Neudert",

export * from './lib/rx-signals-store.module';
//# sourceMappingURL=public-api.d.ts.map

@@ -7,3 +7,3 @@ # @rx-signals/angular-provider

**`npm install --save @rx-signals/angular-provider@3.0.0-rc4`**
**`npm install --save @rx-signals/angular-provider@3.0.0-rc5`**

@@ -18,6 +18,20 @@ If you have not yet installed the _rx-signals_ store, please see [@rx-signals/store](https://github.com/gneu77/rx-signals#installation) documentation on how to install the latest 3.x version of that peer-dependency.

The standard-case should be to use a single `Store` instance over your whole application.
### Modern usage without NgModule
### Using a single store instance over the whole application
In your `bootstrapApplication`, just use `provideStore()`.
This will provide a `Store` singleton everywhere (so even lazy-loaded routes will receive the same store instance).
If you have functions performing setup with the store (`(store: Store) => void`), you can pass 0 to N of those setup-functions as arguments to `provideStore()`.
#### Optionally using child-stores on child-routes
If you're really sure a child-route should use its own child-store, you can do so by using `provideChildStore()` in the corresponding routes providers array.
Make sure to [read the documentation on child-stores](https://rawcdn.githack.com/gneu77/rx-signals/master/docs/tsdoc/classes/Store.html#createChildStore).
Also, be aware that [store-lifecycles](https://rawcdn.githack.com/gneu77/rx-signals/master/docs/tsdoc/classes/Store.html#getLifecycleHandle) might be a better option for your use-case.
### Usage with classic NgModule
In the topmost module that should use the store (AppModule, SharedModule, CoreModule, or whatever it is for you), you can just import `RxSignalsStoreModule`.

@@ -34,3 +48,3 @@ This will provide a `Store` singleton everywhere (so even lazy-loaded feature-modules will receive the same instance).

### Optionally using child-stores
#### Optionally using child-stores

@@ -45,8 +59,6 @@ If you are really sure that you have a feature-module where you want to use a child-store (derived from the root-store that you get with `RxSignalsStoreModule` or `RxSignalsStoreModule.withRootStore()`), then you can do so by importing `RxSignalsStoreModule.withChildStore()`.

If you read about the [concept about side-effect-isolation with the store](https://github.com/gneu77/rx-signals/blob/master/docs/rx-signals_start.md#effect-isolation), you know that the only side-effect that the functions passed to `RxSignalsStoreModule.withRootStore()` and/or `RxSignalsStoreModule.withRootStore()` are allowed to to is calling methods of the passed store.
If you read about the [concept about side-effect-isolation with the store](https://github.com/gneu77/rx-signals/blob/master/docs/rx-signals_start.md#effect-isolation), you know that the only side-effect that the functions passed to `RxSignalsStoreModule.withRootStore()` and/or `RxSignalsStoreModule.withChildStore()` are allowed to do is calling methods of the passed store.
All the signals being setup in this process should be free of side-effects (allowing you to call the setup-functions in your tests without any need of mockup).
Consequently, the side-effects must be injected to the store by corresponding calls to `store.addEffect`.
The suggested way to do so, is to inject the store in services that perform the effects and call `store.addEffect` there.
In your unit-tests, you would then just mock the effects themselves by `store.addEffect(effectId, () => someMockupReturn)` (so no need to mock the whole service).
In your unit-tests, you would then just mock the effects themselves by `store.addEffect(effectId, () => someMockupReturn)` (so no need to mock the whole service).

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc