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

dispatchr

Package Overview
Dependencies
Maintainers
4
Versions
40
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dispatchr - npm Package Compare versions

Comparing version 0.2.2 to 0.2.3

12

lib/Dispatcher.js

@@ -101,3 +101,3 @@ /**

* @param {String} name Name of the store that handles the action
* @param {String} handler Name of the function that handles the action
* @param {String|Function} handler The function or name of the method that handles the action
* @returns {number}

@@ -151,6 +151,10 @@ */

var storeInstance = self.getStore(store.name);
if (!storeInstance[store.handler]) {
throw new Error(store.name + ' does not have a method called ' + store.handler);
if ('function' === typeof store.handler) {
handlerFns[store.name] = store.handler.bind(storeInstance);
} else {
if (!storeInstance[store.handler]) {
throw new Error(store.name + ' does not have a method called ' + store.handler);
}
handlerFns[store.name] = storeInstance[store.handler].bind(storeInstance);
}
handlerFns[store.name] = storeInstance[store.handler].bind(storeInstance);
});

@@ -157,0 +161,0 @@ this.currentAction.execute(handlerFns);

{
"name": "dispatchr",
"version": "0.2.2",
"version": "0.2.3",
"description": "A Flux dispatcher for applications that run on the server and the client.",

@@ -23,3 +23,3 @@ "main": "index.js",

"dependencies": {
"debug": "^1.0.0"
"debug": "^2.0.0"
},

@@ -26,0 +26,0 @@ "devDependencies": {

@@ -22,3 +22,3 @@ # Dispatchr [![Build Status](https://travis-ci.org/yahoo/dispatchr.svg?branch=master)](https://travis-ci.org/yahoo/dispatchr) [![Dependency Status](https://david-dm.org/yahoo/dispatchr.svg)](https://david-dm.org/yahoo/dispatchr) [![Coverage Status](https://coveralls.io/repos/yahoo/dispatchr/badge.png?branch=master)](https://coveralls.io/r/yahoo/dispatchr?branch=master)

## Differences from [Facebook's Flux Dispatcher](https://github.com/facebook/flux/blob/master/examples/flux-chat/js/dispatcher/Dispatcher.js)
## Differences from [Facebook's Flux Dispatcher](https://github.com/facebook/flux/blob/master/src/Dispatcher.js)

@@ -115,3 +115,3 @@ Dispatchr's main goal is to facilitate server-side rendering of Flux applications while also working on the client-side to encourage code reuse. In order to isolate stores between requests on the server-side, we have opted to instantiate the dispatcher and stores classes per request.

The store should define a static property that maps action names to handler function names. These functions will be called in the event that an action has been dispatched by the Dispatchr instance.
The store should define a static property that maps action names to handler functions or method names. These functions will be called in the event that an action has been dispatched by the Dispatchr instance.

@@ -135,2 +135,14 @@ ```js

If you prefer to define private methods for handling actions, you can use a static function instead of a method name. This function will be bound to the store instance when it is called:
```js
ExampleStore.handlers = {
'NAVIGATE': function handleNavigate(payload) {
// bound to store instance
this.navigating = true;
this.emit('change');
}
};
```
### dehydrate()

@@ -137,0 +149,0 @@

Sorry, the diff of this file is not supported yet

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