Huge News!Announcing our $40M Series B led by Abstract Ventures.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.13.4 to 0.13.5

bower.json

17

mixins/ListenerMixin.js

@@ -5,14 +5,23 @@ var MIXIN_REGISTRY = '_alt store listener registry_'

componentWillUnmount: function () {
this[MIXIN_REGISTRY] && this[MIXIN_REGISTRY].forEach(function (x) {
this[MIXIN_REGISTRY].forEach(function (x) {
x.store.unlisten(x.handler)
})
this[MIXIN_REGISTRY] = []
},
listenTo: function (store, handler) {
this[MIXIN_REGISTRY] = this[MIXIN_REGISTRY] || []
this[MIXIN_REGISTRY].push({ store: store, handler: handler })
store.listen(handler)
if (Array.isArray(store)) {
store.forEach(function (s) {
this[MIXIN_REGISTRY].push({ store: s, handler: handler })
s.listen(handler)
}, this)
} else {
this[MIXIN_REGISTRY].push({ store: store, handler: handler })
store.listen(handler)
}
}
}
ListenerMixin[MIXIN_REGISTRY] = []
module.exports = ListenerMixin
{
"name": "alt",
"version": "0.13.4",
"version": "0.13.5",
"description": "A flux implementation",

@@ -33,5 +33,7 @@ "main": "dist/alt.js",

"keywords": [
"alt",
"es6",
"flow",
"flux",
"react",
"flow",
"unidirectional"

@@ -38,0 +40,0 @@ ],

@@ -16,3 +16,3 @@ # alt

Alt is a [flux](http://facebook.github.io/flux/docs/overview.html) implementation that is [small](https://github.com/goatslacker/alt/blob/master/src/alt.js) (~4.3kb & 400 LOC), [well tested](https://github.com/goatslacker/alt/blob/master/test.js), [terse](https://github.com/goatslacker/alt#differences), [insanely flexible](#flexibility), and [forward thinking](#es6).
Alt is a [flux](http://facebook.github.io/flux/docs/overview.html) implementation that is [small](https://github.com/goatslacker/alt/blob/master/src/alt.js) (~4.3kb & 400 LOC), [well tested](https://github.com/goatslacker/alt/tree/master/test), [terse](https://github.com/goatslacker/alt#differences), [insanely flexible](#flexibility), and [forward thinking](#es6).

@@ -115,3 +115,3 @@ Some boilerplate has been removed from flux such as the [JS "constants"](https://github.com/facebook/flux/blob/master/examples/flux-chat/js/constants/ChatConstants.js),

[jstransform](https://github.com/facebook/jstransform) or you can use one of the other popular ES6 transpilers:
[6to5](https://6to5.org/) or [traceur](https://github.com/google/traceur-compiler).
[babel](https://babeljs.io/) or [traceur](https://github.com/google/traceur-compiler).

@@ -118,0 +118,0 @@ You won't need an [es6-shim](https://github.com/paulmillr/es6-shim) but you can use one for further goodies in your javascripts.

@@ -99,6 +99,6 @@ "use strict";

value: function doStoreAsync() {
var _this41 = this;
var _this42 = this;
setTimeout(function () {
_this41.async = true;
_this41.getInstance().emitChange();
_this42.async = true;
_this42.getInstance().emitChange();
});

@@ -148,3 +148,3 @@ return false;

function SecondStore() {
var _this41 = this;
var _this42 = this;
babelHelpers.classCallCheck(this, SecondStore);

@@ -163,3 +163,3 @@

this.on("init", function () {
_this41.recycled = true;
_this42.recycled = true;
});

@@ -258,3 +258,3 @@ }

var LifeCycleStore = function LifeCycleStore() {
var _this41 = this;
var _this42 = this;
babelHelpers.classCallCheck(this, LifeCycleStore);

@@ -268,12 +268,12 @@

this.on("init", function () {
_this41.init = true;
_this42.init = true;
});
this.on("bootstrap", function () {
_this41.bootstrapped = true;
_this42.bootstrapped = true;
});
this.on("snapshot", function () {
_this41.snapshotted = true;
_this42.snapshotted = true;
});
this.on("rollback", function () {
_this41.rollback = true;
_this42.rollback = true;
});

@@ -1037,6 +1037,6 @@ };

value: function onTest() {
var _this41 = this;
var _this42 = this;
setTimeout(function () {
_this41.test = true;
_this41.getInstance().emitChange();
_this42.test = true;
_this42.getInstance().emitChange();
});

@@ -1109,2 +1109,24 @@ return false;

assert.equal(store.getState().baz, true, "inherited methods can be called");
},
"listener mixin": function listenerMixin() {
var ListenerMixin = require("../mixins/ListenerMixin");
var handler = function () {};
ListenerMixin.listenTo(myStore, handler);
assert.equal(ListenerMixin["_alt store listener registry_"].length, 1, "mixin has one handler");
ListenerMixin.componentWillUnmount();
assert.equal(ListenerMixin["_alt store listener registry_"].length, 0, "mixin was unmounted");
ListenerMixin.listenTo([myStore, secondStore], handler);
assert.equal(ListenerMixin["_alt store listener registry_"].length, 2, "mixin has two handlers");
ListenerMixin.componentWillUnmount();
assert.equal(ListenerMixin["_alt store listener registry_"].length, 0, "mixin was unmounted");
}

@@ -1111,0 +1133,0 @@ };

@@ -873,2 +873,24 @@ require('babel/external-helpers')

assert.equal(store.getState().baz, true, 'inherited methods can be called')
},
'listener mixin'() {
let ListenerMixin = require('../mixins/ListenerMixin')
let handler = () => { }
ListenerMixin.listenTo(myStore, handler)
assert.equal(ListenerMixin['_alt store listener registry_'].length, 1, 'mixin has one handler')
ListenerMixin.componentWillUnmount()
assert.equal(ListenerMixin['_alt store listener registry_'].length, 0, 'mixin was unmounted')
ListenerMixin.listenTo([myStore, secondStore], handler)
assert.equal(ListenerMixin['_alt store listener registry_'].length, 2, 'mixin has two handlers')
ListenerMixin.componentWillUnmount()
assert.equal(ListenerMixin['_alt store listener registry_'].length, 0, 'mixin was unmounted')
}

@@ -875,0 +897,0 @@ }

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