Giter Club home page Giter Club logo

redux-subscriber's People

Contributors

eliasparis avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

redux-subscriber's Issues

Dispatch actions on subscription callback

I needed this library for a side project recently, but in my case, I needed to dispatch an action when the subscription callback is invoked.

Also because I was using redux-thunk extensively, I would like to have a similar convention where the callback receives via arguments, the dispatcher and state.

Because of that, I didn't want to make a pull request, but if you want to have a look and let me know what you think, I could continue working towards a PR.

https://github.com/tol-is/redux-subscriber

`initSubscriber` returning `subscribe` api (?)

Hi there! First of all, very nice idea, thanks for implementing this module! Pretty simple implementation and quite useful.

I was curious to know whether you considered returning subscribe api when calling initSubscriber.
See following example:

import {createStore} from 'redux';
import initSubscriber from 'redux-subscriber';

const store = createStore(...);
const subscriber = initSubscriber(store);

subscriber.subscribe('user.messages.count', state => {
    // do something
});

I think that makes it very clear from where the subscribe method come from.

Dispatching actions in callbackFunction

Hi @ivantsov ) Your lib is very helpful in projects, thank you.

Recently I encountered such a phenomenon that when any action is activated inside the callback function, the callback function is called again and again.

The Redux website says that their subscription function allows the dispatch of actions inside the callback function.

What if I need to make a dispatch inside the callback function? Is this possible?

Thank you)

Subscribe handler being fired twice for one change

Subscribe callback is being fired twice when there is only one state change.

Code here:

import Subscriber from 'redux-subscriber'
import store from './my-store'

const subscribe = Subscriber(store)

subscribe('org.selected', state => {

  console.log('RENDERING', 'org.selected') // this is being output twice per state change

  renderSelection(state)

})

Can you think of a reason that the handler may be fired twice with only one action dispatched? Perhaps I'm missing something?

Note that when I comment out the redux-subscriber code and use the normal store.subscribe method, it works as expected; the output shows once per action. Is it possible the subscriber is changing the way the store dispatches?

Wired behavior with setState in sub

I have the following code which is straight forward

const subToNewDataChange = subscribe('newData', state => {
            const random = Math.random() * (100 - 15) + 15;
            this.setState({key:random }, function () {
                this.forceUpdate();
            }.bind(this));
        })

But on Andriod only I'm the getting an error with setState not being a function, which If I understand correctly is a binding issue. What is confusing is that it's only happing on Andiord and it's somewhat random i.e. sometimes it works without any error which makes me think it has something to do with the package, not binding correctly any ideas?

subscribing to boolean variables

Hi ivantsov great project, you have the easiest to understand subscribing package for redux I could find.

I'm only getting started using this project but I have noticed when subscribing to Boolean properties the project does not seem to pickup the changes.

For my project I have just changed the Boolean properties to an integer with 1/0 values

Cheers
mrjono1

[Question]: TypeScript types?

Feel free to remove this issue, but I wasn't sure where to ask questions. I noticed there are no types in DefinitelyTyped. Have you heard of anyone that has created TS types for this API already? As a truly lazy dev, I'd like to reuse and recycle :)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.