Comparing version 0.25.1 to 0.26.0
{ | ||
"name": "cerebral", | ||
"version": "0.25.1", | ||
"version": "0.26.0", | ||
"description": "A state controller with its own debugger", | ||
@@ -5,0 +5,0 @@ "main": "src/index.js", |
@@ -8,3 +8,3 @@ var CreateSignalFactory = require('./CreateSignalFactory.js'); | ||
module.exports = function (Model, services) { | ||
var Controller = function (Model, services) { | ||
@@ -54,1 +54,31 @@ var controller = new EventEmitter(); | ||
}; | ||
Controller.ServerController = function (state) { | ||
var model = { | ||
accessors: { | ||
get: function (path) { | ||
path = path.slice(); | ||
var key = path.pop(); | ||
var grabbedState = state; | ||
while (path.length) { | ||
grabbedState = grabbedState[path.shift()]; | ||
} | ||
return grabbedState[key]; | ||
} | ||
} | ||
}; | ||
var compute = Compute(model); | ||
return { | ||
isServer: true, | ||
get: function (path) { | ||
if (typeof arguments[0] === 'function') { | ||
return compute.has(arguments[0]) ? compute.getComputedValue(arguments[0]) : compute.register(arguments[0]); | ||
} | ||
var path = !arguments.length ? [] : typeof arguments[0] === 'string' ? [].slice.call(arguments) : arguments[0]; | ||
return model.accessors.get(path); | ||
} | ||
} | ||
}; | ||
module.exports = Controller; |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
4351280
48311