All Projects → tappleby → Redux Batched Subscribe

tappleby / Redux Batched Subscribe

Licence: mit
store enhancer for https://github.com/reactjs/redux which allows batching subscribe notifications.

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to Redux Batched Subscribe

Pprof
pprof is a tool for visualization and analysis of profiling data
Stars: ✭ 4,990 (+922.54%)
Mutual labels:  performance
Graphql Crunch
Reduces the size of GraphQL responses by consolidating duplicate values
Stars: ✭ 472 (-3.28%)
Mutual labels:  performance
Bundle Wizard
Magically easy insight into the JavaScript loaded by a web app
Stars: ✭ 479 (-1.84%)
Mutual labels:  performance
React Virtualized
React components for efficiently rendering large lists and tabular data
Stars: ✭ 22,963 (+4605.53%)
Mutual labels:  performance
Trace Nodejs
Trace is a visualised distributed tracing platform designed for microservices.
Stars: ✭ 471 (-3.48%)
Mutual labels:  performance
Android Tips Tricks
☑️ [Cheatsheet] Tips and tricks for Android Development
Stars: ✭ 4,496 (+821.31%)
Mutual labels:  performance
Dwarfs
A fast high compression read-only file system
Stars: ✭ 444 (-9.02%)
Mutual labels:  performance
Cloud Design Patterns
Prescriptive Architecture Guidance for Cloud Applications
Stars: ✭ 484 (-0.82%)
Mutual labels:  performance
Scandir
Better directory iterator and faster os.walk(), now in the Python 3.5 stdlib
Stars: ✭ 471 (-3.48%)
Mutual labels:  performance
Ubiquity
Ubiquity framework
Stars: ✭ 480 (-1.64%)
Mutual labels:  performance
Halide
a language for fast, portable data-parallel computation
Stars: ✭ 4,722 (+867.62%)
Mutual labels:  performance
Gearbox
Gearbox ⚙️ is a web framework written in Go with a focus on high performance
Stars: ✭ 455 (-6.76%)
Mutual labels:  performance
Nimporter
Compile Nim Extensions for Python On Import!
Stars: ✭ 474 (-2.87%)
Mutual labels:  performance
Iris
The fastest HTTP/2 Go Web Framework. AWS Lambda, gRPC, MVC, Unique Router, Websockets, Sessions, Test suite, Dependency Injection and more. A true successor of expressjs and laravel | 谢谢 https://github.com/kataras/iris/issues/1329 |
Stars: ✭ 21,587 (+4323.57%)
Mutual labels:  performance
Maghead
The fastest pure PHP database framework with a powerful static code generator, supports horizontal scale up, designed for PHP7
Stars: ✭ 483 (-1.02%)
Mutual labels:  performance
Happypack
Happiness in the form of faster webpack build times.
Stars: ✭ 4,232 (+767.21%)
Mutual labels:  performance
Processhacker
A free, powerful, multi-purpose tool that helps you monitor system resources, debug software and detect malware.
Stars: ✭ 6,285 (+1187.91%)
Mutual labels:  performance
Laravel Pjax
A pjax middleware for Laravel
Stars: ✭ 487 (-0.2%)
Mutual labels:  performance
Garie
Open source web performance
Stars: ✭ 484 (-0.82%)
Mutual labels:  performance
Netfabric.hyperlinq
High performance LINQ implementation with minimal heap allocations. Supports enumerables, async enumerables, arrays and Span<T>.
Stars: ✭ 479 (-1.84%)
Mutual labels:  performance

redux-batched-subscribe

build status npm version

Store enhancer for redux which allows batching of subscribe notifications that occur as a result of dispatches.

npm install --save redux-batched-subscribe

Usage

The batchedSubscribe store enhancer accepts a function which is called after every dispatch with a notify callback as a single argument. Calling the notify callback will trigger all the subscription handlers, this gives you the ability to use various techniques to delay subscription notifications such as: debouncing, React batched updates or requestAnimationFrame.

Since batchedSubscribe overloads the dispatch and subscribe handlers on the original redux store it is important that it gets applied before any other store enhancers or middleware that depend on these functions; The compose utility in redux can be used to handle this:

import { createStore, applyMiddleware, compose } from 'redux';
import { batchedSubscribe } from 'redux-batched-subscribe';

const enhancer = compose(
  applyMiddleware(...middleware),
  batchedSubscribe((notify) => {
    notify();
  })
)

// Note: passing enhancer as the last argument to createStore requires [email protected]>=3.1.0
const store = createStore(reducer, initialState, enhancer);

Note: since compose applies functions from right to left, batchedSubscribe should appear at the end of the chain.

The store enhancer also exposes a subscribeImmediate method which allows for unbatched subscribe notifications.

Examples

Debounced subscribe handlers:

import { createStore } from 'redux';
import { batchedSubscribe } from 'redux-batched-subscribe';
import debounce from 'lodash.debounce';

const debounceNotify = debounce(notify => notify());
// Note: passing batchedSubscribe as the last argument to createStore requires [email protected]>=3.1.0
const store = createStore(reducer, intialState, batchedSubscribe(debounceNotify));

React batched updates

import { createStore } from 'redux';
import { batchedSubscribe } from 'redux-batched-subscribe';

// React >= 0.14
import { unstable_batchedUpdates } from 'react-dom';

// Note: passing batchedSubscribe as the last argument to createStore requires [email protected]>=3.1.0
const store = createStore(reducer, intialState, batchedSubscribe(unstable_batchedUpdates));

Thanks

Thanks to Andrew Clark for the clean library structure.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].