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

docbrown

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

docbrown - npm Package Compare versions

Comparing version 0.0.1 to 0.0.2

26

index.js

@@ -6,15 +6,15 @@ (function() {

function Dispatcher() {
this._stores = {};
this._registered = {};
// format: {actionA: [storeA, storeB], actionB: [storeC]}
this._actionHandlers = {};
}
Dispatcher.prototype = {
get registered() {
return this._registered;
get actionHandlers() {
return this._actionHandlers;
},
register: function(action, store) {
if (this.registeredFor(action).indexOf(store) !== -1) return;
if (this.registered.hasOwnProperty(action)) {
this.registered[action].push(store);
if (this.actionHandlers.hasOwnProperty(action)) {
this.actionHandlers[action].push(store);
} else {
this.registered[action] = [store];
this.actionHandlers[action] = [store];
}

@@ -24,3 +24,3 @@ },

var actionArgs = [].slice.call(arguments, 1);
(this._registered[action] || []).forEach(function(store) {
(this.actionHandlers[action] || []).forEach(function(store) {
if (typeof store[action] === "function") {

@@ -32,3 +32,3 @@ store[action].apply(store, actionArgs);

registeredFor: function(action) {
return this.registered[action] || [];
return this.actionHandlers[action] || [];
}

@@ -42,13 +42,13 @@ };

DocBrown.createActions = function(dispatcher, actions) {
DocBrown.createActions = function(dispatcher, actionNames) {
if (!(dispatcher instanceof Dispatcher)) {
throw new Error("Invalid dispatcher");
}
if (!Array.isArray(actions)) {
if (!Array.isArray(actionNames)) {
throw new Error("Invalid actions array");
}
var baseActions = actions.reduce(function(actions, name) {
var baseActions = actionNames.reduce(function(actions, name) {
actions[name] = dispatcher.dispatch.bind(dispatcher, name);
return actions;
}, {_dispatcher: dispatcher, _registered: actions});
}, {_dispatcher: dispatcher, _registered: actionNames});
baseActions.only = function() {

@@ -55,0 +55,0 @@ if (!arguments.length) return this;

{
"name": "docbrown",
"version": "0.0.1",
"version": "0.0.2",
"description": "Flux experiment.",

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

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