New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

harukaze

Package Overview
Dependencies
Maintainers
1
Versions
13
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

harukaze - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

40

lib/dispatcher.js

@@ -8,11 +8,18 @@ var _ = require('lodash');

var dirtyStores = [];
var dispatching = false;
function dispatch(type, payload) {
if (dispatching) {
return Promise.reject('Cascading dispatches are prohibited. Fix your flux.');
}
dispatching = true;
return new Promise(function (resolve, reject) {
logger.logMessage(type, payload);
bus.push({type: type, payload: payload});
logger.logDirtyStores(dirtyStores);
pushChanges(dirtyStores);
clearDirtyMarks();
resolve();
try {
logger.logMessage(type, payload);
bus.push({type: type, payload: payload});
pushChanges();
resolve();
} finally {
dispatching = false;
}
});

@@ -34,14 +41,15 @@ }

function pushChanges(dirtyStores) {
setTimeout(function () {
_.each(dirtyStores, function (store) {
store.changes.push(store.output);
});
}, 0);
function pushChanges() {
var also = false;
while(dirtyStores.length > 0) {
logger.logDirtyStores(dirtyStores, also);
var stores = dirtyStores;
dirtyStores = [];
_.each(stores, function (store) {
store.changes.push(store.output);
});
also = true;
}
}
function clearDirtyMarks() {
dirtyStores = [];
}
module.exports = {

@@ -48,0 +56,0 @@ dispatch: dispatch,

4

lib/logger.js

@@ -39,6 +39,6 @@ var _ = require('lodash');

logDirtyStores: function (dirtyStores) {
logDirtyStores: function (dirtyStores, also) {
if (!debug.enabled) { return; }
if (dirtyStores.length) {
console.log("CHANGED STORES: %s", _.pluck(dirtyStores, 'displayName').join(', '));
console.log("%sCHANGED STORES: %s", (also ? 'ALSO ' : ''), _.pluck(dirtyStores, 'displayName').join(', '));
} else {

@@ -45,0 +45,0 @@ console.log("NO STORES CHANGED.");

{
"name": "harukaze",
"version": "0.1.0",
"version": "0.1.1",
"description": "A reactive flux architecture implementation",

@@ -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