This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { EffectsModule } from '@ngrx/effects'; | |
import { MovieEffects } from './effects/movie.effects'; | |
@NgModule({ | |
imports: [ | |
... | |
EffectsModule.forRoot([MovieEffects]) | |
] | |
}) | |
export class AppModule {} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { Injectable } from '@angular/core'; | |
import { Effect, Actions } from '@ngrx/effects'; | |
import { of } from 'rxjs/observable/of'; | |
import { map, switchMap, catchError } from 'rxjs/operators'; | |
import * as fromRoot from '../../../app/store'; | |
import * as movieActions from '../actions/movie.action'; | |
import * as fromServices from '../../services'; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
if (isFunction(_unsubscribe)) { | |
try { | |
_unsubscribe.call(this); | |
} catch (e) { | |
// some error logic | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export interface SubscriptionLike extends Unsubscribable { | |
unsubscribe(): void; | |
readonly closed: boolean; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(unsubscribe?: () => void) { | |
if (unsubscribe) { | |
(<any> this)._unsubscribe = unsubscribe; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
constructor(unsubscribe?: () => void) { | |
if (unsubscribe) { | |
(<any> this)._unsubscribe = unsubscribe; | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** @internal */ | |
protected _parentOrParents: Subscription | Subscription[] | null = null; | |
/** @internal */ | |
private _subscriptions: SubscriptionLike[] | null = null; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Subscriber<T> extends Subscription implements Observer<T> {...} | |
interface Observer<T> { | |
closed?: boolean; | |
next: (value: T) => void; | |
error: (err: any) => void; | |
complete: () => void; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected destination: Observer<any> | Subscriber<any>; | |
constructor(destinationOrNext?: PartialObserver<any> | ((value: T) => void) | null, | |
error?: ((e?: any) => void) | null, | |
complete?: (() => void) | null) { | |
super(); | |
switch (arguments.length) { | |
case A: | |
this.destination = emptyObserver; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
next(value?: T): void { | |
if (!this.isStopped) { | |
this._next(value!); | |
} | |
} | |
error(err?: any): void { | |
if (!this.isStopped) { | |
this.isStopped = true; | |
this._error(err); |
OlderNewer