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.0 to 0.13.1

3

dist/alt-with-runtime.js

@@ -285,2 +285,3 @@ "use strict";

var actions = assign({}, getInternalMethods(ActionsClass.prototype, builtInProto));
var key = ActionsClass.displayName || ActionsClass.name;

@@ -312,3 +313,3 @@ function ActionsGenerator() {

var constant = formatAsConstant(action);
var actionName = Symbol["for"]("action " + action);
var actionName = Symbol("action " + key + "#" + action);

@@ -315,0 +316,0 @@ // Wrap the action so we can provide a dispatch method

@@ -289,2 +289,3 @@ "use strict";

var actions = assign({}, getInternalMethods(ActionsClass.prototype, builtInProto));
var key = ActionsClass.displayName || ActionsClass.name;

@@ -316,3 +317,3 @@ function ActionsGenerator() {

var constant = formatAsConstant(action);
var actionName = Symbol["for"]("action " + action);
var actionName = Symbol("action " + key + "#" + action);

@@ -319,0 +320,0 @@ // Wrap the action so we can provide a dispatch method

{
"name": "alt",
"version": "0.13.0",
"version": "0.13.1",
"description": "A flux implementation",

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

@@ -71,2 +71,7 @@ "use strict";

var myActionsInst = this.alt.getActions("myActions");
if (myActionsInst) {
this.bindAction(myActionsInst.updateName, this.onUpdateName);
}
this.bindAction(myActions.updateName, this.onUpdateName);

@@ -129,3 +134,3 @@ this.bindAction(myActions.CALL_INTERNAL_METHOD, this.doCallInternal);

function SecondStore() {
var _this35 = this;
var _this37 = this;
to5Runtime.classCallCheck(this, SecondStore);

@@ -144,3 +149,3 @@

this.on("init", function () {
_this35.recycled = true;
_this37.recycled = true;
});

@@ -239,3 +244,3 @@ }

var LifeCycleStore = function LifeCycleStore() {
var _this35 = this;
var _this37 = this;
to5Runtime.classCallCheck(this, LifeCycleStore);

@@ -249,12 +254,12 @@

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

@@ -297,6 +302,4 @@ };

function NameStore() {
// It's ok to bind whatever actions since Symbol.for maintains
// a global registry. As long as the methods called in nameActions2 are defined
// in nameActions1 so the constants are created.
this.bindActions(nameActions1);
this.bindActions(nameActions2);
this.name = "foo";

@@ -537,2 +540,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e.message, "You have multiple action handlers bound to an action: updateName and onUpdateName", "error message is correct");

@@ -581,2 +587,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e.message, "You have multiple action handlers bound to an action: updateName and onUpdateName", "error message is correct");

@@ -612,2 +621,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e.message, "Invalid action reference passed in", "proper error message for undefined action");

@@ -629,2 +641,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e.message, "bindAction expects a function", "proper error message for undefined action");

@@ -672,2 +687,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e.message, "Dispatch tokens not provided", "must provide dispatch tokens");

@@ -702,2 +720,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e instanceof TypeError, true, "A TypeError was thrown, you cant bind two args with bindActions");

@@ -730,2 +751,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e instanceof TypeError, true, "A TypeError was thrown, you cant bind two args with bindAction");

@@ -753,2 +777,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e instanceof ReferenceError, true, "error was thrown for store with same name");

@@ -764,2 +791,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e instanceof ReferenceError, true, "error was thrown for store with same name");

@@ -811,2 +841,5 @@ }

} catch (e) {
if (e.name === "AssertionError") {
throw e;
}
assert.equal(e instanceof ReferenceError, true, "store that does not exist throws a RefenceError");

@@ -843,4 +876,103 @@ assert.equal(e.message, "StoreThatDoesNotExist is not a valid store");

assert.equal(myStore.getState().name, "first", "other singleton store not affected");
},
"actions with the same name": function actionsWithTheSameName() {
var alt = new Alt();
function UserActions() {
this.generateActions("update");
}
var ua = alt.createActions(UserActions);
function LinkActions() {
this.generateActions("update");
}
var la = alt.createActions(LinkActions);
function Store() {
this.bindAction(ua.UPDATE, this.ua);
this.bindAction(la.UPDATE, this.la);
this.a = 0;
this.b = 0;
}
Store.prototype.ua = function () {
this.a = 1;
};
Store.prototype.la = function () {
this.b = 1;
};
var store = alt.createStore(Store);
ua.update();
la.update();
var state = store.getState();
assert.equal(state.a, 1, "both actions were called");
assert.equal(state.b, 1, "both actions were called");
},
"actions with the same name and same class name": function actionsWithTheSameNameAndSameClassName() {
var alt = new Alt();
var ua = (function () {
function a() {
this.generateActions("update");
}
return alt.createActions(a);
})();
var la = (function () {
function a() {
this.generateActions("update");
}
return alt.createActions(a);
})();
var Store = (function () {
function Store() {
to5Runtime.classCallCheck(this, Store);
this.bindAction(ua.UPDATE, this.ua);
this.bindAction(la.UPDATE, this.la);
this.a = 0;
this.b = 0;
}
to5Runtime.prototypeProperties(Store, null, {
ua: {
value: function ua() {
this.a = 1;
},
writable: true,
configurable: true
},
la: {
value: function la() {
this.b = 1;
},
writable: true,
configurable: true
}
});
return Store;
})();
var store = alt.createStore(Store);
ua.update();
la.update();
var state = store.getState();
assert.equal(state.a, 1, "both actions were called");
assert.equal(state.b, 1, "both actions were called");
}
};

@@ -53,2 +53,7 @@ require('6to5/runtime')

constructor() {
let myActionsInst = this.alt.getActions('myActions')
if (myActionsInst) {
this.bindAction(myActionsInst.updateName, this.onUpdateName)
}
this.bindAction(myActions.updateName, this.onUpdateName)

@@ -205,6 +210,4 @@ this.bindAction(myActions.CALL_INTERNAL_METHOD, this.doCallInternal)

function NameStore() {
// It's ok to bind whatever actions since Symbol.for maintains
// a global registry. As long as the methods called in nameActions2 are defined
// in nameActions1 so the constants are created.
this.bindActions(nameActions1)
this.bindActions(nameActions2)
this.name = 'foo'

@@ -430,2 +433,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e.message, 'You have multiple action handlers bound to an action: updateName and onUpdateName', 'error message is correct')

@@ -448,2 +454,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e.message, 'You have multiple action handlers bound to an action: updateName and onUpdateName', 'error message is correct')

@@ -467,2 +476,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e.message, 'Invalid action reference passed in', 'proper error message for undefined action')

@@ -482,2 +494,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e.message, 'bindAction expects a function', 'proper error message for undefined action')

@@ -511,2 +526,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e.message, 'Dispatch tokens not provided', 'must provide dispatch tokens')

@@ -529,2 +547,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e instanceof TypeError, true, 'A TypeError was thrown, you cant bind two args with bindActions')

@@ -545,2 +566,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e instanceof TypeError, true, 'A TypeError was thrown, you cant bind two args with bindAction')

@@ -568,2 +592,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e instanceof ReferenceError, true, 'error was thrown for store with same name')

@@ -579,2 +606,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e instanceof ReferenceError, true, 'error was thrown for store with same name')

@@ -626,2 +656,5 @@ }

} catch (e) {
if (e.name === 'AssertionError') {
throw e
}
assert.equal(e instanceof ReferenceError, true, 'store that does not exist throws a RefenceError')

@@ -658,3 +691,85 @@ assert.equal(e.message, 'StoreThatDoesNotExist is not a valid store')

assert.equal(myStore.getState().name, 'first', 'other singleton store not affected')
},
'actions with the same name'() {
var alt = new Alt()
function UserActions() {
this.generateActions('update')
}
var ua = alt.createActions(UserActions)
function LinkActions() {
this.generateActions('update')
}
var la = alt.createActions(LinkActions)
function Store() {
this.bindAction(ua.UPDATE, this.ua)
this.bindAction(la.UPDATE, this.la)
this.a = 0
this.b = 0
}
Store.prototype.ua = function () {
this.a = 1
}
Store.prototype.la = function () {
this.b = 1
}
var store = alt.createStore(Store)
ua.update()
la.update()
var state = store.getState()
assert.equal(state.a, 1, 'both actions were called')
assert.equal(state.b, 1, 'both actions were called')
},
'actions with the same name and same class name'() {
var alt = new Alt()
var ua = (function () {
function a() { this.generateActions('update') }
return alt.createActions(a)
}())
var la = (function () {
function a() { this.generateActions('update') }
return alt.createActions(a)
}())
class Store {
constructor() {
this.bindAction(ua.UPDATE, this.ua)
this.bindAction(la.UPDATE, this.la)
this.a = 0
this.b = 0
}
ua() {
this.a = 1
}
la() {
this.b = 1
}
}
var store = alt.createStore(Store)
ua.update()
la.update()
var state = store.getState()
assert.equal(state.a, 1, 'both actions were called')
assert.equal(state.b, 1, 'both actions were called')
}
}
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