Socket
Socket
Sign inDemoInstall

@ngrx/effects

Package Overview
Dependencies
Maintainers
3
Versions
142
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@ngrx/effects - npm Package Compare versions

Comparing version 2.0.0-beta.3 to 2.0.0

bundles/effects-testing.min.umd.js

9

index.d.ts

@@ -1,4 +0,5 @@

export { Effect, mergeEffects } from './effects';
export { Actions } from './actions';
export { EffectsModule } from './module';
export { EffectsSubscription } from './effects-subscription';
export { Effect, mergeEffects } from './src/effects';
export { Actions } from './src/actions';
export { EffectsModule } from './src/effects.module';
export { EffectsSubscription } from './src/effects-subscription';
export { toPayload } from './src/util';

@@ -1,10 +0,6 @@

"use strict";
var effects_1 = require('./effects');
exports.Effect = effects_1.Effect;
exports.mergeEffects = effects_1.mergeEffects;
var actions_1 = require('./actions');
exports.Actions = actions_1.Actions;
var module_1 = require('./module');
exports.EffectsModule = module_1.EffectsModule;
var effects_subscription_1 = require('./effects-subscription');
exports.EffectsSubscription = effects_subscription_1.EffectsSubscription;
export { Effect, mergeEffects } from './src/effects';
export { Actions } from './src/actions';
export { EffectsModule } from './src/effects.module';
export { EffectsSubscription } from './src/effects-subscription';
export { toPayload } from './src/util';
//# sourceMappingURL=index.js.map

@@ -1,1 +0,1 @@

{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./effects","export":["Effect","mergeEffects"]},{"from":"./actions","export":["Actions"]},{"from":"./module","export":["EffectsModule"]},{"from":"./effects-subscription","export":["EffectsSubscription"]}]}
{"__symbolic":"module","version":1,"metadata":{},"exports":[{"from":"./src/effects","export":["Effect","mergeEffects"]},{"from":"./src/actions","export":["Actions"]},{"from":"./src/effects.module","export":["EffectsModule"]},{"from":"./src/effects-subscription","export":["EffectsSubscription"]},{"from":"./src/util","export":["toPayload"]}]}
{
"name": "@ngrx/effects",
"version": "2.0.0-beta.3",
"version": "2.0.0",
"description": "Side effect model for @ngrx/store",
"main": "index.js",
"jsnext:main": "esm/index.js",
"main": "bundles/effects.umd.js",
"module": "index.js",
"repository": {

@@ -12,19 +12,20 @@ "type": "git",

"scripts": {
"lint": "npm-run-all lint:*",
"lint:lib": "tslint lib/**.ts",
"lint:spec": "tslint spec/**.ts",
"clean": "rimraf ./release",
"prebuild": "npm-run-all clean karma",
"build": "npm-run-all build:*",
"build:cjs": "ngc -p tsconfig.cjs.json",
"build:esm": "ngc -p tsconfig.es2015.json",
"build:ts": "cpy src/*.ts release/src",
"prepare": "cpy ./{package.json,README.md,CHANGELOG.md,LICENSE} ./release",
"test": "npm-run-all clean karma",
"karma": "karma start --single-run",
"karma:watch": "karma start",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s",
"preversion": "npm run test",
"version": "npm run changelog && git add CHANGELOG.md",
"postversion": "npm run prepare"
"test": "npm run karma",
"changelog": "conventional-changelog -p angular -i CHANGELOG.md -s -r 0",
"clean:pre": "rimraf release",
"clean:post": "rimraf src/**/*.ngfactory.ts",
"copy": "cpy LICENSE package.json README.md release",
"build:js": "ngc -p tsconfig.dist.json",
"build:testing": "ngc -p tsconfig.testing.json",
"build:umd": "rollup -c rollup.config.js",
"build:umd:testing": "rollup -c rollup-testing.config.js",
"build:uglify": "uglifyjs -c --screw-ie8 --comments -o ./release/bundles/effects.min.umd.js ./release/bundles/effects.umd.js",
"build:uglify:testing": "uglifyjs -c --screw-ie8 --comments -o ./release/bundles/effects-testing.min.umd.js ./release/bundles/effects-testing.umd.js",
"bundle:main": "npm run build:js && npm run build:umd && npm run build:uglify",
"bundle:testing": "npm run build:testing && npm run build:umd:testing && npm run build:uglify:testing",
"prebuild": "npm run test && npm run clean:pre",
"postbuild": "npm run clean:post && npm run copy",
"build": "npm run bundle:main && npm run bundle:testing",
"version": "npm run changelog && git add CHANGELOG.md"
},

@@ -36,16 +37,18 @@ "authors": [

"peerDependencies": {
"rxjs": "^5.0.0-beta.11",
"@angular/core": "^2.0.0-rc.5",
"@ngrx/store": "^2.0.0"
"rxjs": "^5.0.0-beta.12",
"@angular/core": "^2.0.0",
"@ngrx/store": "^1.5.0 || ^2.0.0"
},
"devDependencies": {
"@angular/common": "^2.0.0-rc.1",
"@angular/compiler": "^2.0.0-rc.1",
"@angular/compiler-cli": "^0.6.0",
"@angular/core": "^2.0.0-rc.1",
"@angular/platform-browser": "^2.0.0-rc.1",
"@angular/platform-browser-dynamic": "^2.0.0-rc.1",
"@angular/platform-server": "^2.0.0-rc.5",
"@ngrx/core": "^1.1.0",
"@types/jasmine": "^2.2.31",
"@angular/common": "^2.0.0",
"@angular/compiler": "^2.0.0",
"@angular/compiler-cli": "^0.6.1",
"@angular/core": "^2.0.0",
"@angular/platform-browser": "^2.0.0",
"@angular/platform-browser-dynamic": "^2.0.0",
"@angular/platform-server": "^2.0.0",
"@angular/router": "^3.0.0",
"@ngrx/core": "^1.2.0",
"@ngrx/store": "^2.0.0",
"@types/jasmine": "^2.2.33",
"@types/node": "^6.0.38",

@@ -55,4 +58,5 @@ "awesome-typescript-loader": "^2.2.1",

"core-js": "^2.2.2",
"cpy-cli": "^1.0.1",
"istanbul-instrumenter-loader": "^0.2.0",
"jasmine-core": "^2.4.1",
"jasmine-core": "^2.5.0",
"karma": "^0.13.22",

@@ -68,10 +72,13 @@ "karma-chrome-launcher": "^0.2.3",

"reflect-metadata": "^0.1.3",
"rxjs": "^5.0.0-beta.11",
"rollup": "^0.34.13",
"rxjs": "^5.0.0-beta.12",
"source-map-loader": "^0.1.5",
"ts-loader": "^0.8.1",
"tslint": "^3.6.0",
"ts-loader": "^0.8.2",
"tslint": "^3.15.1",
"tslint-loader": "^2.1.5",
"typescript": "^2.0.2",
"uglifyjs": "^2.4.10",
"webpack": "^2.1.0-beta.21",
"zone.js": "^0.6.8"
"zone.js": "^0.6.17"
}
}

@@ -10,57 +10,11 @@ # @ngrx/effects

```
### Example Application
https://github.com/ngrx/example-app
### Documentation
## Effects
In @ngrx/effects, effects are _sources of actions_. You use the `@Effect()` decorator to hint which observables on a service are action sources, and @ngrx/effects automatically merges your action streams letting you subscribe them to store.
* [Intro to @ngrx/effects](./docs/intro.md)
* [API](./docs/api.md)
* [Testing](./docs/testing.md)
To help you compose new action sources, @ngrx/effects exports an `Actions` observable service that emits every action dispatched in your application.
### Example Application
### Example
1. Create an AuthEffects service that describes a source of login actions:
```ts
import { Injectable } from '@angular/core';
import { Http } from '@angular/http';
import { Actions, Effect } from '@ngrx/effects';
@Injectable()
export class AuthEffects implements OnDestroy {
constructor(
private http: Http,
private actions$: Actions
) { }
@Effect() login$ = this.actions$
// Listen for the 'LOGIN' action
.ofType('LOGIN')
// Map the payload into JSON to use as the request body
.map(action => JSON.stringify(action.payload))
.switchMap(payload => this.http.post('/auth', payload)
// If successful, dispatch success action with result
.map(res => ({ type: 'LOGIN_SUCCESS', payload: res.json() }))
// If request fails, dispatch failed action
.catch(() => Observable.of({ type: 'LOGIN_FAILED' }));
);
}
```
2. Provide your service via `EffectsModule.run` to automatically start your effect:
```ts
import { AuthEffects } from './effects/auth';
import { EffectsModule } from '@ngrx/effects';
@NgModule({
imports: [
EffectsModule.run(AuthEffects)
]
})
export class AppModule { }
```
*Note*: For effects that depend on the application to be bootstrapped (i.e. effects that depend on the Router) use `EffectsModule.runAfterBootstrap`. Be aware that `runAfterBootstrap` will only work in the root module.
### Testing Effects
WIP
https://github.com/ngrx/example-app
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