diff --git a/lib/create_store.js b/lib/create_store.js index ad2cb34..d9cf8a9 100644 --- a/lib/create_store.js +++ b/lib/create_store.js @@ -50,7 +50,8 @@ 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); @@ -58,6 +59,7 @@ createStore.mixSpecIntoComponent = function mixSpecIntoComponent(component, spec 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; } }