Skip to content

Commit

Permalink
Allow marking mixin functions as unchainable.
Browse files Browse the repository at this point in the history
  • Loading branch information
STRML committed Feb 6, 2015
1 parent c4f5ea3 commit 4929b7c
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion lib/create_store.js
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,16 @@ createStore.mixSpecIntoComponent = function mixSpecIntoComponent(component, spec

// Functions are chained, with mixin functions being run before spec functions.
else if (typeof spec[key] === "function") {
if (component[key]) {
// Allow users to mark a function as unchainable via 'chainable'
if (component[key] && component[key].chainable !== false) {
// Only functions can be chained.
if (typeof component[key] !== "function") {
throw new FunctionChainingError(key);
}
component[key] = createStore.createChainedFunction(component[key], spec[key]).bind(component);
} else {
component[key] = spec[key].bind(component);
if (spec[key].chainable === false) component[key].chainable = false;
}
}

Expand Down

0 comments on commit 4929b7c

Please sign in to comment.