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

alt

Package Overview
Dependencies
Maintainers
1
Versions
70
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

alt - npm Package Compare versions

Comparing version 0.16.9 to 0.16.10

docs/utils/hotReload.md

14

CHANGELOG.md
# Changelog
## 0.16.10
### Added
* componentDidConnect for connectToStores. Allows you to specify data fetching in there. [commit](https://github.com/goatslacker/alt/commit/464bb26)
* Hot reload of stores using webpack. [commit](https://github.com/goatslacker/alt/commit/66c875c)
### Changed
* Reversed the then/catch in the promise resolution for data sources so the catch only handles data source failures. [commit](https://github.com/goatslacker/alt/commit/8e1418b)
* Throw when passing `undefined` to store.unlisten. [commit](https://github.com/goatslacker/alt/commit/4998c6a)
## 0.16.9

@@ -4,0 +18,0 @@

6

dist/alt.js

@@ -912,2 +912,3 @@ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.Alt = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){

value: function unlisten(cb) {
if (!cb) throw new TypeError('Unlisten must receive a function');
this[Sym.LIFECYCLE].emit('unlisten');

@@ -1008,3 +1009,3 @@ this[EE].removeListener('change', cb);

var makeActionHandler = function makeActionHandler(action) {
var makeActionHandler = function makeActionHandler(action, isError) {
return function (x) {

@@ -1014,2 +1015,3 @@ var fire = function fire() {

action(intercept(x, action, args));
if (isError) throw x;
};

@@ -1027,3 +1029,3 @@ return typeof window === 'undefined' ? function () {

if (spec.loading) spec.loading(intercept(null, spec.loading, args));
return spec.remote.apply(spec, [state].concat(args)).then(makeActionHandler(spec.success))['catch'](makeActionHandler(spec.error));
return spec.remote.apply(spec, [state].concat(args))['catch'](makeActionHandler(spec.error, 1)).then(makeActionHandler(spec.success));
} else {

@@ -1030,0 +1032,0 @@ // otherwise emit the change now

@@ -119,2 +119,3 @@ 'use strict';

value: function unlisten(cb) {
if (!cb) throw new TypeError('Unlisten must receive a function');
this[Sym.LIFECYCLE].emit('unlisten');

@@ -121,0 +122,0 @@ this[EE].removeListener('change', cb);

@@ -79,3 +79,3 @@ 'use strict';

var makeActionHandler = function makeActionHandler(action) {
var makeActionHandler = function makeActionHandler(action, isError) {
return function (x) {

@@ -85,2 +85,3 @@ var fire = function fire() {

action(intercept(x, action, args));
if (isError) throw x;
};

@@ -98,3 +99,3 @@ return typeof window === 'undefined' ? function () {

if (spec.loading) spec.loading(intercept(null, spec.loading, args));
return spec.remote.apply(spec, [state].concat(args)).then(makeActionHandler(spec.success))['catch'](makeActionHandler(spec.error));
return spec.remote.apply(spec, [state].concat(args))['catch'](makeActionHandler(spec.error, 1)).then(makeActionHandler(spec.success));
} else {

@@ -101,0 +102,0 @@ // otherwise emit the change now

{
"name": "alt",
"version": "0.16.9",
"version": "0.16.10",
"description": "A flux implementation",

@@ -5,0 +5,0 @@ "main": "lib",

@@ -157,4 +157,58 @@ import { jsdom } from 'jsdom'

assert(span.props.foo === 'Baz')
},
'componentDidConnect hook is called '() {
let componentDidConnect = false
class ClassComponent extends React.Component {
static getStores() {
return [testStore]
}
static getPropsFromStores(props) {
return testStore.getState()
}
static componentDidConnect() {
componentDidConnect = true
}
render() {
return <span foo={this.props.foo} />
}
}
const WrappedComponent = connectToStores(ClassComponent)
const node = TestUtils.renderIntoDocument(
<WrappedComponent />
)
assert(componentDidConnect === true)
},
'Component receives all updates'(done) {
let componentDidConnect = false
class ClassComponent extends React.Component {
static getStores() {
return [testStore]
}
static getPropsFromStores(props) {
return testStore.getState()
}
static componentDidConnect() {
testActions.updateFoo('Baz')
componentDidConnect = true
}
componentDidUpdate() {
assert(this.props.foo === 'Baz')
done()
}
render() {
return <span foo={this.props.foo} />
}
}
const WrappedComponent = connectToStores(ClassComponent)
let node = TestUtils.renderIntoDocument(
<WrappedComponent />
)
const span = TestUtils.findRenderedDOMComponentWithTag(node, 'span')
assert(componentDidConnect === true)
}
}
}

@@ -582,2 +582,6 @@ import Alt from '../'

assert.ok(mooseChecker.calledOnce)
assert.throws(() => {
myStore.unlisten()
})
},

@@ -595,3 +599,3 @@

// unlisten directly
store.listen()()
store.listen(function () { })()

@@ -598,0 +602,0 @@ assert.ok(unlistener.calledOnce, 'unlisten lifecycle hook called')

@@ -74,3 +74,3 @@ /**

getInitialState: function getInitialState() {
return Component.getPropsFromStores(this.props);
return Component.getPropsFromStores(this.props, this.context);
},

@@ -81,6 +81,9 @@

var stores = Component.getStores(this.props);
var stores = Component.getStores(this.props, this.context);
stores.forEach(function (store) {
store.listen(_this.onChange);
});
if (Component.componentDidConnect) {
Component.componentDidConnect(this.props, this.context);
}
},

@@ -91,3 +94,3 @@

var stores = Component.getStores(this.props);
var stores = Component.getStores(this.props, this.context);
stores.forEach(function (store) {

@@ -99,3 +102,3 @@ store.unlisten(_this2.onChange);

onChange: function onChange() {
this.setState(Component.getPropsFromStores(this.props));
this.setState(Component.getPropsFromStores(this.props, this.context));
},

@@ -102,0 +105,0 @@

Sorry, the diff of this file is too big to display

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