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
{ | |
"name": "moment", | |
... | |
"typings": "./moment.d.ts", ... | |
} |
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
declare namespace moment { | |
//.. | |
interface Moment extends Object { | |
format(format?: string): string; | |
startOf(unitOfTime: unitOfTime.StartOf): Moment; | |
endOf(unitOfTime: unitOfTime.StartOf): Moment; | |
//.. | |
} | |
//.. |
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
declare namespace moment { | |
//.. | |
interface Moment extends Object { | |
format(format?: string): string; | |
startOf(unitOfTime: unitOfTime.StartOf): Moment; | |
endOf(unitOfTime: unitOfTime.StartOf): Moment; | |
//.. | |
} | |
//.. |
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 declare class Actions<V = Action> extends Observable<V> { | |
constructor(source?: Observable<V>); | |
lift<R>(operator: Operator<V, R>): Observable<R>; | |
//.. | |
} |
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
/** | |
* @whatItDoes Provides convenience methods for implementing common operations of persisting data. | |
*/ | |
export declare class DataPersistence <T> { | |
store: Store<T>; | |
actions: Actions; | |
constructor(store: Store<T>, actions: Actions); | |
// ... |
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
@Effect() loadPosts$ = this.dataPersistence.fetch( | |
PostsActionTypes.LoadPosts, | |
{ | |
run: (action: LoadPosts, state: PostsPartialState) => { | |
return this.postsService.getPosts().pipe( | |
map((posts: Post[]) => new PostsLoaded(posts)) | |
); | |
}, | |
onError: (action: LoadPosts, error) => { | |
console.error('Error', error); |
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 { Subject } from 'rxjs'; | |
const random = Math.random(); | |
const randomVal$ = new Subject().next(random); | |
// Subscribe to run the combined functions | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.8771441274333971 (random number) | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.8771441274333971 (random number) |
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 { Subject } from 'rxjs'; | |
const randomVals$ = new Subject().next(Math.random());} | |
// Subscribe to run the combined functions | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.24957144215097515 (random number) | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.004617340049055896 (random number) |
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 { Subject } from 'rxjs'; | |
const randomVals$ = new Subject().next(Math.random());} | |
// Subscribe to run the combined functions | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.24957144215097515 (random number) | |
randomVals$.subscribe(x => console.log(x)); | |
// 0.004617340049055896 (random number) |
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
@Effect() | |
loadAllBlogPosts$: Observable<any> = this.actions$.pipe( | |
ofType(PokemonActions.loadPokemon), | |
mergeMap(() => | |
this.postsService.getAll().pipe( | |
map(posts => PokemonActions.loadPokemonSuccess({ posts })), | |
catchError(message => of(PokemonActions.loadPostsFailed({ message }))) | |
) | |
) | |
); |