0.1.1-beta.1 • Published 7 years ago

@mr-luke/vredux v0.1.1-beta.1

Weekly downloads
-
License
ISC
Repository
github
Last release
7 years ago

@mr-luke/vRedux

This is RxJS implementation of Redux with build-in async ActionCreator for Angular2.

Installation

npm install @mr-luke/vredux

Basic Usage

import { VReduxModule } from '@mr-luke/vredux';

export const initState = {
    stateKey: 0/* Init value of stateKey */
};
export const reducer = (state, action) => {
    switch (action.type) {
        // Compose your reducer like for Redux
        // Don't forget to return state for default
        default:
            return state;
    }
};

@NgModule({
    imports: [
        BrowserModule,
        VReduxModule.forRoot({ stateKey: reducer }, initState);
    ]
})
export class AppModule {}

VReduxModule.forRoot(reducers: Object, initState); Notice! Don't use vReduxModule alone during import. Constructing redux vStore require .forRoot()

import { Component } from '@angular/core';
import { VStore } from '@mr-luke/vRedux';

@Component({
    selector: 'app-root',
    template: '<h1>{{ statePart | async }}</h1>'
})
export class AppComponent {

    public statePart: any;

    constructor(private store: VStore){
        this.statePart = this.store.select('stateKey');
    }

}

Tests

npm run test

Contributing

In lieu of a formal style guide, take care to maintain the existing coding style. Add unit tests for any new or changed functionality. Lint and test your code.

0.1.1-beta.1

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago