3.2.0 • Published 2 years ago

vivy-subscription v3.2.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

vivy-subscription

NPM Version License

A Vivy plugin which extend Vivy model to watch history or something else to update state by dispatching a reducer or action.

Docs

Installation

Using npm:

$ npm install vivy vivy-subscription

Examples

Examples in repository

$ cd ./examples/[EXAMPLE_NAME]
$ npm run start

Example names:

Complete and real project example

Documentation

Basic usage

index.js

import React from 'react';
import {render} from 'react-dom';
import {Provider} from 'react-vivy';

// Import Vivy
import Vivy from 'vivy';

// Import Vivy subscription plugin
import vivySubscription from 'vivy-subscription';

// Import your component and model
import App from 'path_to_app_component';
import app from 'path_to_app_model';

// Create vivy
const vivy = Vivy();

// Apply subscription plugin
vivy.use(vivySubscription());

// Create store after configuration
const store = vivy.createStore();

// Register vivy model
store.registerModel(app);

render(
    <Provider store={store}>
        <App/>
    </Provider>,
    document.getElementById('app-container')
);

app.js

export default {
    nameSpace: 'app',
    state: null,
    subscriptions: {

        // Define a subscription
        yourSubscription: ({history}) => (dispatch, getState) => {
            // Bind history listening or do something else
        }

    }
};
3.2.0

2 years ago

3.0.2

2 years ago

3.1.0

2 years ago

3.0.1

2 years ago

3.0.0

2 years ago

3.0.0-alpha.0

2 years ago

2.0.3

3 years ago

2.0.2

3 years ago

2.0.5

3 years ago

2.0.4

3 years ago

2.0.1

3 years ago

1.1.0

3 years ago

1.0.1

4 years ago

1.0.0

4 years ago

0.1.3

4 years ago

2.0.0

3 years ago

0.1.2

4 years ago

0.1.0

4 years ago

0.1.1

4 years ago

0.0.3

4 years ago

0.0.2

4 years ago

0.0.1

4 years ago