Skip to content

Commit

Permalink
Run build
Browse files Browse the repository at this point in the history
  • Loading branch information
goatslacker committed Mar 14, 2015
1 parent e30d269 commit 43731ce
Show file tree
Hide file tree
Showing 4 changed files with 125 additions and 64 deletions.
48 changes: 32 additions & 16 deletions dist/alt-browser-with-addons.js
Original file line number Diff line number Diff line change
Expand Up @@ -1013,6 +1013,7 @@ var INIT_SNAPSHOT = Symbol("init snapshot storage");
var LAST_SNAPSHOT = Symbol("last snapshot storage");
var LIFECYCLE = Symbol("store lifecycle listeners");
var LISTENERS = Symbol("stores action listeners storage");
var PUBLIC_METHODS = Symbol("store public method storage");
var STATE_CONTAINER = Symbol("the state container");

function formatAsConstant(name) {
Expand Down Expand Up @@ -1049,7 +1050,7 @@ var getInternalMethods = function (obj, excluded) {

var AltStore = (function () {
function AltStore(dispatcher, state) {
var _this6 = this;
var _this7 = this;

_classCallCheck(this, AltStore);

Expand All @@ -1058,12 +1059,13 @@ var AltStore = (function () {
this[STATE_CONTAINER] = state;

assign(this[LIFECYCLE], state[LIFECYCLE]);
assign(this, state[PUBLIC_METHODS]);

// Register dispatcher
this.dispatchToken = dispatcher.register(function (payload) {
if (state[LISTENERS][payload.action]) {
var result = state[LISTENERS][payload.action](payload.data);
result !== false && _this6.emitChange();
result !== false && _this7.emitChange();
}
});

Expand Down Expand Up @@ -1151,7 +1153,7 @@ var StoreMixin = {
},

bindActions: function bindActions(actions) {
var _this6 = this;
var _this7 = this;

Object.keys(actions).forEach(function (action) {
var symbol = actions[action];
Expand All @@ -1161,40 +1163,40 @@ var StoreMixin = {
});
var handler = null;

if (_this6[action] && _this6[assumedEventHandler]) {
if (_this7[action] && _this7[assumedEventHandler]) {
// If you have both action and onAction
throw new ReferenceError("You have multiple action handlers bound to an action: " + ("" + action + " and " + assumedEventHandler));
} else if (_this6[action]) {
} else if (_this7[action]) {
// action
handler = _this6[action];
} else if (_this6[assumedEventHandler]) {
handler = _this7[action];
} else if (_this7[assumedEventHandler]) {
// onAction
handler = _this6[assumedEventHandler];
handler = _this7[assumedEventHandler];
}

if (handler) {
_this6.bindAction(symbol, handler);
_this7.bindAction(symbol, handler);
}
});
},

bindListeners: function bindListeners(obj) {
var _this6 = this;
var _this7 = this;

Object.keys(obj).forEach(function (methodName) {
var symbol = obj[methodName];
var listener = _this6[methodName];
var listener = _this7[methodName];

if (!listener) {
throw new ReferenceError("" + methodName + " defined but does not exist in " + _this6._storeName);
throw new ReferenceError("" + methodName + " defined but does not exist in " + _this7._storeName);
}

if (Array.isArray(symbol)) {
symbol.forEach(function (action) {
return _this6.bindAction(action, listener);
return _this7.bindAction(action, listener);
});
} else {
_this6.bindAction(symbol, listener);
_this7.bindAction(symbol, listener);
}
});
},
Expand All @@ -1215,6 +1217,18 @@ var StoreMixin = {
});

this.dispatcher.waitFor(tokens);
},

exportPublicMethods: function exportPublicMethods(methods) {
var _this7 = this;

Object.keys(methods).forEach(function (methodName) {
if (typeof methods[methodName] !== "function") {
throw new TypeError("exportPublicMethods expects a function");
}

_this7[PUBLIC_METHODS][methodName] = methods[methodName];
});
}
};

Expand Down Expand Up @@ -1302,6 +1316,7 @@ var Alt = (function () {

this[LIFECYCLE] = {};
this[LISTENERS] = {};
this[PUBLIC_METHODS] = {};
_get(Object.getPrototypeOf(Store.prototype), "constructor", this).call(this, alt);
}

Expand Down Expand Up @@ -1356,7 +1371,7 @@ var Alt = (function () {
},
createActions: {
value: function createActions(ActionsClass) {
var _this6 = this;
var _this7 = this;

var exportObj = arguments[1] === undefined ? {} : arguments[1];

Expand Down Expand Up @@ -1403,7 +1418,7 @@ var Alt = (function () {
var actionName = Symbol("" + key + "#" + action);

// Wrap the action so we can provide a dispatch method
var newAction = new ActionCreator(_this6, actionName, actions[action], obj);
var newAction = new ActionCreator(_this7, actionName, actions[action], obj);

// Set all the properties on action
obj[action] = newAction[ACTION_HANDLER];
Expand Down Expand Up @@ -1538,6 +1553,7 @@ function ActionListeners(alt) {
*/
ActionListeners.prototype.addActionListener = function (symAction, handler) {
var id = this.dispatcher.register(function (payload) {
/* istanbul ignore else */
if (symAction === payload.action) {
handler(payload.data);
}
Expand Down
47 changes: 31 additions & 16 deletions dist/alt-browser.js
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,7 @@ var INIT_SNAPSHOT = Symbol("init snapshot storage");
var LAST_SNAPSHOT = Symbol("last snapshot storage");
var LIFECYCLE = Symbol("store lifecycle listeners");
var LISTENERS = Symbol("stores action listeners storage");
var PUBLIC_METHODS = Symbol("store public method storage");
var STATE_CONTAINER = Symbol("the state container");

function formatAsConstant(name) {
Expand Down Expand Up @@ -793,7 +794,7 @@ var getInternalMethods = function (obj, excluded) {

var AltStore = (function () {
function AltStore(dispatcher, state) {
var _this6 = this;
var _this7 = this;

_classCallCheck(this, AltStore);

Expand All @@ -802,12 +803,13 @@ var AltStore = (function () {
this[STATE_CONTAINER] = state;

assign(this[LIFECYCLE], state[LIFECYCLE]);
assign(this, state[PUBLIC_METHODS]);

// Register dispatcher
this.dispatchToken = dispatcher.register(function (payload) {
if (state[LISTENERS][payload.action]) {
var result = state[LISTENERS][payload.action](payload.data);
result !== false && _this6.emitChange();
result !== false && _this7.emitChange();
}
});

Expand Down Expand Up @@ -895,7 +897,7 @@ var StoreMixin = {
},

bindActions: function bindActions(actions) {
var _this6 = this;
var _this7 = this;

Object.keys(actions).forEach(function (action) {
var symbol = actions[action];
Expand All @@ -905,40 +907,40 @@ var StoreMixin = {
});
var handler = null;

if (_this6[action] && _this6[assumedEventHandler]) {
if (_this7[action] && _this7[assumedEventHandler]) {
// If you have both action and onAction
throw new ReferenceError("You have multiple action handlers bound to an action: " + ("" + action + " and " + assumedEventHandler));
} else if (_this6[action]) {
} else if (_this7[action]) {
// action
handler = _this6[action];
} else if (_this6[assumedEventHandler]) {
handler = _this7[action];
} else if (_this7[assumedEventHandler]) {
// onAction
handler = _this6[assumedEventHandler];
handler = _this7[assumedEventHandler];
}

if (handler) {
_this6.bindAction(symbol, handler);
_this7.bindAction(symbol, handler);
}
});
},

bindListeners: function bindListeners(obj) {
var _this6 = this;
var _this7 = this;

Object.keys(obj).forEach(function (methodName) {
var symbol = obj[methodName];
var listener = _this6[methodName];
var listener = _this7[methodName];

if (!listener) {
throw new ReferenceError("" + methodName + " defined but does not exist in " + _this6._storeName);
throw new ReferenceError("" + methodName + " defined but does not exist in " + _this7._storeName);
}

if (Array.isArray(symbol)) {
symbol.forEach(function (action) {
return _this6.bindAction(action, listener);
return _this7.bindAction(action, listener);
});
} else {
_this6.bindAction(symbol, listener);
_this7.bindAction(symbol, listener);
}
});
},
Expand All @@ -959,6 +961,18 @@ var StoreMixin = {
});

this.dispatcher.waitFor(tokens);
},

exportPublicMethods: function exportPublicMethods(methods) {
var _this7 = this;

Object.keys(methods).forEach(function (methodName) {
if (typeof methods[methodName] !== "function") {
throw new TypeError("exportPublicMethods expects a function");
}

_this7[PUBLIC_METHODS][methodName] = methods[methodName];
});
}
};

Expand Down Expand Up @@ -1046,6 +1060,7 @@ var Alt = (function () {

this[LIFECYCLE] = {};
this[LISTENERS] = {};
this[PUBLIC_METHODS] = {};
_get(Object.getPrototypeOf(Store.prototype), "constructor", this).call(this, alt);
}

Expand Down Expand Up @@ -1100,7 +1115,7 @@ var Alt = (function () {
},
createActions: {
value: function createActions(ActionsClass) {
var _this6 = this;
var _this7 = this;

var exportObj = arguments[1] === undefined ? {} : arguments[1];

Expand Down Expand Up @@ -1147,7 +1162,7 @@ var Alt = (function () {
var actionName = Symbol("" + key + "#" + action);

// Wrap the action so we can provide a dispatch method
var newAction = new ActionCreator(_this6, actionName, actions[action], obj);
var newAction = new ActionCreator(_this7, actionName, actions[action], obj);

// Set all the properties on action
obj[action] = newAction[ACTION_HANDLER];
Expand Down
Loading

0 comments on commit 43731ce

Please sign in to comment.