Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pusher-redux

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pusher-redux - npm Package Compare versions

Comparing version 0.3.6 to 0.3.7

7

lib/pusher-redux.js

@@ -36,2 +36,5 @@ 'use strict';

}
if (options.additionalParams) {
result.additionalParams = options.additionalParams
}
return result;

@@ -94,3 +97,3 @@ };

module.exports.subscribe = function (channelName, eventName, actionType) {
module.exports.subscribe = function (channelName, eventName, actionType, additionalParams) {
addToQueue(function () {

@@ -108,3 +111,3 @@ var channel = config.socket.channel(channelName) || config.socket.subscribe(channelName);

eventSubs[actionType] = function (data) {
config.store.dispatch(pusherAction({ actionType: actionType, channelName: channelName, eventName: eventName, data: data }));
config.store.dispatch(pusherAction({ actionType: actionType, channelName: channelName, eventName: eventName, data: data, additionalParams: additionalParams }));
};

@@ -111,0 +114,0 @@ channel.bind(eventName, eventSubs[actionType]);

{
"name": "pusher-redux",
"version": "0.3.6",
"version": "0.3.7",
"description": "Integration of Pusher into Redux",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -39,13 +39,25 @@ # pusher-redux

}
componentWillUnmount() {
this.unsubscribe();
}
// upon receiving event 'some_event' for channel 'some_channel' pusher-redux is going to dispatch action NEW_ORDER
// add additional params which will be merged into pusherAction and dispatched along with it
// you can bind multiple actions for the same event and it's gonna dispatch all of them
subscribe() {
subscribe('some_channel', 'some_event', NEW_ORDER);
// your additionalParams
const additionalParams = () => {}
subscribe('some_channel', 'some_event', NEW_ORDER, additionalParams);
// access it within the data object = {
// type: String,
// channel: String,
// event: String,
// data: Object,
// additionalParams: Any
// }
}
unsubscribe() {

@@ -52,0 +64,0 @@ unsubscribe('some_channel', 'some_event', NEW_ORDER);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc