Skip to content

Commit

Permalink
Adds an export object to createActions
Browse files Browse the repository at this point in the history
  • Loading branch information
goatslacker committed Feb 2, 2015
1 parent fb6b20b commit dc7c75d
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
5 changes: 3 additions & 2 deletions dist/alt.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,8 +244,9 @@ var Alt = (function () {
return this.stores[key];
};

Alt.prototype.createActions = function (ActionsClass) {
Alt.prototype.createActions = function (ActionsClass, exportObj) {
var _this4 = this;
if (exportObj === undefined) exportObj = {};
var key = ActionsClass.displayName || ActionsClass.name;
var actions = assign({}, getInternalMethods(ActionsClass.prototype, builtInProto));

Expand Down Expand Up @@ -282,7 +283,7 @@ var Alt = (function () {
obj[constant] = actionName;

return obj;
}, {});
}, exportObj);
};

Alt.prototype.takeSnapshot = function () {
Expand Down
4 changes: 2 additions & 2 deletions src/alt.js
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ your own custom identifier for each store`
return this.stores[key]
}

createActions(ActionsClass) {
createActions(ActionsClass, exportObj = {}) {
let key = ActionsClass.displayName || ActionsClass.name
let actions = assign(
{},
Expand Down Expand Up @@ -281,7 +281,7 @@ your own custom identifier for each store`
obj[constant] = actionName

return obj
}, {})
}, exportObj)
}

takeSnapshot() {
Expand Down
3 changes: 2 additions & 1 deletion test.js
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ class MyActions {
}
}

var myActions = alt.createActions(MyActions)
var myActions = {}
alt.createActions(MyActions, myActions)

class MyStore {
constructor() {
Expand Down

0 comments on commit dc7c75d

Please sign in to comment.