Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivate cross-tab synchronization? #21

Open
Discordius opened this issue Nov 3, 2017 · 1 comment
Open

Deactivate cross-tab synchronization? #21

Discordius opened this issue Nov 3, 2017 · 1 comment
Assignees
Milestone

Comments

@Discordius
Copy link

I am actually using the package to determine polling intervals for my site, and for that use-case, synchronizing the activity state across browser intervals is actually the opposite of what I want, since I don't want the client to request new data for tabs that they aren't active in.

Is there any way to deactivate the cross-tab activity detection?

@cchamberlain cchamberlain self-assigned this Nov 15, 2017
@cchamberlain cchamberlain added this to the 1.0 milestone Nov 15, 2017
@cchamberlain
Copy link
Member

@Discordius sorry for the long delay. I try and respond quickly but was out of town last week and have been busy playing catch up.

This is very similar to a request I've gotten before and I think its a reasonable thing to add support for. The previous request was to make one client "the master" that effectively did all the communications: noderaider/localsync#2.

My current thoughts are to implement some optional arguments:

activeStatusPrimaryAction: (dispatch, getState) => void;
idleStatusPrimaryAction: (idleStatus) => (dispatch, getState) => void;

If these are passed, redux-idle-monitor would ensure they are only run on the currently active tab instead of all tabs. Can't think of a good use case or naming convention for running something on all the non-active tabs at this time so I'm only aiming to add the two above.

I was already planning on upgrading the source of this library and localsync to TypeScript - going to start on that now and will attempt to rope this functionality in, then do a major release on both.

Appreciate the request!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants