Comparing version 0.27.0 to 0.28.0
@@ -1,2 +0,2 @@ | ||
function addTodo (args, state, output) { | ||
function addTodo ({state, output}) { | ||
@@ -3,0 +3,0 @@ var ref = state.get('nextRef'); |
@@ -1,2 +0,2 @@ | ||
function clearCompleted (args, state) { | ||
function clearCompleted ({state}) { | ||
@@ -3,0 +3,0 @@ let todos = state.get('todos'); |
@@ -1,4 +0,4 @@ | ||
function editTodo (args, state) { | ||
function editTodo ({input, state}) { | ||
const path = ['todos', args.ref]; | ||
const path = ['todos', input.ref]; | ||
let todo = state.get(path); | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
function play (input, state, output, services) { | ||
function play ({state, services}) { | ||
services.recorder.seek(0); | ||
@@ -3,0 +3,0 @@ state.merge('recorder', { |
@@ -1,2 +0,2 @@ | ||
function record (input, state, output, services) { | ||
function record ({state, services}) { | ||
state.set(['recorder', 'isRecording'], true); | ||
@@ -3,0 +3,0 @@ services.recorder.record(); |
@@ -1,5 +0,5 @@ | ||
function removeTodo (args, state) { | ||
state.unset(['todos', args.ref]); | ||
function removeTodo ({input, state}) { | ||
state.unset(['todos', input.ref]); | ||
}; | ||
export default removeTodo; |
@@ -1,4 +0,4 @@ | ||
function saveTodo (args, state, next) { | ||
function saveTodo ({input, state, output}) { | ||
let todo = state.get('todos', args.ref); | ||
let todo = state.get('todos', input.ref); | ||
@@ -9,3 +9,3 @@ // Simulating posting the todo.data and get an ID from | ||
next.success({ | ||
output.success({ | ||
id: Date.now() + parseInt(Math.random() * 1000) | ||
@@ -12,0 +12,0 @@ }); |
@@ -1,2 +0,2 @@ | ||
function setFilter (input, state) { | ||
function setFilter ({input, state}) { | ||
state.set('filter', input.filter); | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
function setNewTodoTitle (input, state, output) { | ||
function setNewTodoTitle ({input, state}) { | ||
state.set('newTodoTitle', input.title); | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
function setSaving (args, state) { | ||
function setSaving ({state}) { | ||
state.set('isSaving', true); | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
function setTodoError (input, state) { | ||
function setTodoError ({input, state}) { | ||
@@ -3,0 +3,0 @@ var path = ['todos', input.ref]; |
@@ -1,4 +0,4 @@ | ||
function setTodoNewTitle (args, state) { | ||
state.merge(['todos', args.ref], { | ||
$newTitle: args.title | ||
function setTodoNewTitle ({input, state}) { | ||
state.merge(['todos', input.ref], { | ||
$newTitle: input.title | ||
}); | ||
@@ -5,0 +5,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
function setUrl (args, state, next) { | ||
state.set('url', args.path); | ||
function setUrl ({input, state}) { | ||
state.set('url', input.path); | ||
}; | ||
export default setUrl; |
@@ -1,2 +0,2 @@ | ||
function setVisibleTodos (args, state) { | ||
function setVisibleTodos ({state}) { | ||
@@ -3,0 +3,0 @@ let todos = state.get('todos'); |
@@ -1,2 +0,2 @@ | ||
function stop (input, state, output, services) { | ||
function stop ({state, services}) { | ||
state.merge('recorder', { | ||
@@ -3,0 +3,0 @@ isPlaying: false, |
@@ -1,4 +0,4 @@ | ||
function stopEditingTodo (args, state) { | ||
function stopEditingTodo ({input, state}) { | ||
const path = ['todos', args.ref]; | ||
const path = ['todos', input.ref]; | ||
let todo = state.get(path); | ||
@@ -5,0 +5,0 @@ |
@@ -1,2 +0,2 @@ | ||
function toggleAllChecked (args, state) { | ||
function toggleAllChecked ({state}) { | ||
@@ -3,0 +3,0 @@ let isCompleted = !state.get('isAllChecked'); |
@@ -1,4 +0,3 @@ | ||
function toggleTodoCompleted (args, state) { | ||
console.log(args); | ||
const path = ['todos', args.ref]; | ||
function toggleTodoCompleted ({input, state}) { | ||
const path = ['todos', input.ref]; | ||
let todo = state.get(path); | ||
@@ -5,0 +4,0 @@ state.set(path.concat('completed'), !todo.completed); |
@@ -1,2 +0,2 @@ | ||
function unsetFilter (args, state) { | ||
function unsetFilter ({state}) { | ||
state.set('filter', 'all'); | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,2 +0,2 @@ | ||
function unsetSaving (args, state) { | ||
function unsetSaving ({state}) { | ||
state.set('isSaving', false); | ||
@@ -3,0 +3,0 @@ }; |
@@ -1,4 +0,4 @@ | ||
function updateTodo (args, state) { | ||
function updateTodo ({input, state}) { | ||
var path = ['todos', args.ref]; | ||
var path = ['todos', input.ref]; | ||
@@ -8,3 +8,3 @@ let todo = state.get(path); | ||
state.merge(path, { | ||
id: args.id, | ||
id: input.id, | ||
$isSaving: false | ||
@@ -11,0 +11,0 @@ }); |
{ | ||
"name": "cerebral", | ||
"version": "0.27.0", | ||
"version": "0.28.0", | ||
"description": "A state controller with its own debugger", | ||
@@ -19,3 +19,3 @@ "main": "src/index.js", | ||
"cerebral-baobab": "^0.3.1", | ||
"cerebral-react": "^0.8.0", | ||
"cerebral-react": "^0.9.0", | ||
"cerebral-router": "^0.8.0", | ||
@@ -22,0 +22,0 @@ "classnames": "^2.1.1", |
@@ -91,3 +91,3 @@ var utils = require('./utils.js'); | ||
if (!signalStore.isRemembering() && !recorder.isCatchingUp()) { | ||
controller.emit('signalStart', signal); | ||
controller.emit('signalStart', {signal: signal}); | ||
} | ||
@@ -112,4 +112,4 @@ | ||
signal.isExecuting = false; | ||
controller.emit('signalEnd', signal); | ||
controller.emit('change'); | ||
controller.emit('signalEnd', {signal: signal}); | ||
controller.emit('change', {signal: signal}); | ||
devtools && devtools.update(); | ||
@@ -157,7 +157,7 @@ return; | ||
controller.emit('actionStart', true); | ||
controller.emit('change'); | ||
controller.emit('change', {signal}); | ||
var promises = currentBranch.map(function (action) { | ||
controller.emit('actionStart', {action: action, signal: signal}); | ||
var actionFunc = actions[action.actionIndex]; | ||
@@ -176,3 +176,9 @@ var inputArg = actionFunc.defaultInput ? utils.merge({}, actionFunc.defaultInput, signalArgs) : signalArgs; | ||
var next = createNext.async(actionFunc); | ||
actionFunc.apply(null, actionArgs.concat(next.fn, services)); | ||
actionFunc.call(null, { | ||
input: actionArgs[0], | ||
state: actionArgs[1], | ||
output: next.fn, | ||
services: services | ||
}); | ||
return next.promise.then(function (result) { | ||
@@ -196,4 +202,5 @@ | ||
action.outputPath = result.path; | ||
controller.emit('actionEnd', {action: action, signal: signal}); | ||
var result = runBranch(action.outputs[result.path], 0, Date.now()); | ||
controller.emit('change'); | ||
controller.emit('change', {signal: signal}); | ||
devtools && devtools.update(); | ||
@@ -238,4 +245,4 @@ return result; | ||
controller.emit('actionStart', false); | ||
var action = currentBranch; | ||
controller.emit('actionStart', {action: action, signal: signal}); | ||
var actionFunc = actions[action.actionIndex]; | ||
@@ -253,3 +260,8 @@ var inputArg = actionFunc.defaultInput ? utils.merge({}, actionFunc.defaultInput, signalArgs) : signalArgs; | ||
var next = createNext.sync(actionFunc, signal.name); | ||
actionFunc.apply(null, actionArgs.concat(next, services)); | ||
actionFunc.call(null, { | ||
input: actionArgs[0], | ||
state: actionArgs[1], | ||
output: next, | ||
services: services | ||
}); | ||
@@ -281,7 +293,7 @@ // TODO: Also add input here | ||
return result.then(function () { | ||
controller.emit('actionEnd'); | ||
controller.emit('actionEnd', {action: action, signal: signal}); | ||
return runBranch(branch, index + 1, start); | ||
}); | ||
} else { | ||
controller.emit('actionEnd'); | ||
controller.emit('actionEnd', {action: action, signal: signal}); | ||
return runBranch(branch, index + 1, start); | ||
@@ -288,0 +300,0 @@ } |
var CreateSignalFactory = require('./CreateSignalFactory.js'); | ||
var CreateSignalStore = require('./CreateSignalStore.js'); | ||
var CreateRecorder = require('./CreateRecorder.js'); | ||
var CreateRegisterModules = require('./CreateRegisterModules.js'); | ||
var Devtools = require('./Devtools.js'); | ||
@@ -56,16 +57,4 @@ var Compute = require('./Compute.js'); | ||
controller.extends = function (modules) { | ||
var meta = {}; | ||
Object.keys(modules).forEach(function (moduleName) { | ||
var module = modules[moduleName]; | ||
Object.keys(module).forEach(function (key) { | ||
if (key === 'init') { | ||
meta[moduleName] = module[key](controller, moduleName); | ||
} else { | ||
controller.signal(moduleName + '.' + key, module[key]); | ||
} | ||
}); | ||
}); | ||
return meta; | ||
}; | ||
controller.modules = {}; | ||
controller.register = CreateRegisterModules(controller); | ||
@@ -72,0 +61,0 @@ return controller; |
@@ -14,3 +14,5 @@ var reporter = require('nodeunit').reporters.default; | ||
'computed': 'tests/computed.js', | ||
'accessors': 'tests/accessors.js' | ||
'accessors': 'tests/accessors.js', | ||
'staticTree': 'tests/staticTree.js', | ||
'modules': 'tests/modules.js' | ||
}; | ||
@@ -17,0 +19,0 @@ |
@@ -22,7 +22,6 @@ var Controller = require('./../src/index.js'); | ||
var signal = [ | ||
function (input, state) { | ||
function (args) { | ||
test.ok(args.state.get); | ||
test.ok(args.state.keys); | ||
test.ok(state.get); | ||
test.ok(state.keys); | ||
} | ||
@@ -53,6 +52,6 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
state.get('foo'); | ||
state.get(['foo']); | ||
state.get('foo', 'bar'); | ||
function (args) { | ||
args.state.get('foo'); | ||
args.state.get(['foo']); | ||
args.state.get('foo', 'bar'); | ||
} | ||
@@ -84,7 +83,7 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
state.get('foo', 'bar'); | ||
function (args) { | ||
args.state.get('foo', 'bar'); | ||
} | ||
]; | ||
ctrl.signal('test', signal); | ||
@@ -91,0 +90,0 @@ test.expect(2); |
@@ -109,4 +109,4 @@ var Controller = require('./../src/index.js'); | ||
var signal = [ | ||
function (input, state) { | ||
state.set('test', 'hest2') | ||
function (args) { | ||
args.state.set('test', 'hest2') | ||
} | ||
@@ -141,4 +141,4 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
state.set(['test'], 'hest2') | ||
function (args) { | ||
args.state.set(['test'], 'hest2') | ||
} | ||
@@ -185,4 +185,4 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
state.merge(['data', 'messages'], { | ||
function (args) { | ||
args.state.merge(['data', 'messages'], { | ||
'123': {title: 'test', liked: true}, | ||
@@ -193,3 +193,3 @@ '456': {title: 'test2', liked: true}, | ||
}); | ||
state.set(['lists', 'displayedMessagesIds'], ['123']); | ||
args.state.set(['lists', 'displayedMessagesIds'], ['123']); | ||
} | ||
@@ -246,4 +246,4 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
test.equal(state.get(foo), 'bar'); | ||
function (args) { | ||
test.equal(args.state.get(foo), 'bar'); | ||
test.done(); | ||
@@ -250,0 +250,0 @@ } |
@@ -20,13 +20,13 @@ var Controller = require('./../src/index.js'); | ||
var signal = [ | ||
function (input, state) { | ||
function (args) { | ||
state.set('foo', 'value'); | ||
state.set(['foo'], 'value'); | ||
args.state.set('foo', 'value'); | ||
args.state.set(['foo'], 'value'); | ||
} | ||
]; | ||
ctrl.signal('test', signal); | ||
ctrl.signals.test(true); | ||
ctrl.signals.test.sync(); | ||
test.done() | ||
}; |
@@ -29,4 +29,4 @@ var Controller = require('./../src/index.js'); | ||
var signal = [ | ||
function (args, state) { | ||
state.set('foo', args.foo); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
} | ||
@@ -78,6 +78,6 @@ ]; | ||
var signal = [ | ||
function (input, state) { | ||
state.set('foo', input.foo); | ||
}, [function (input, state, output) { | ||
output(); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
}, [function (args) { | ||
args.output(); | ||
}] | ||
@@ -136,4 +136,4 @@ ]; | ||
var signal = [ | ||
function (args, state) { | ||
state.set('foo', args.foo); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
} | ||
@@ -189,4 +189,4 @@ ]; | ||
var signal = [ | ||
function (args, state) { | ||
state.set('foo', args.foo); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
} | ||
@@ -254,4 +254,4 @@ ]; | ||
var signal = [ | ||
function (args, state) { | ||
state.set('foo', args.foo); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
} | ||
@@ -258,0 +258,0 @@ ]; |
@@ -28,3 +28,2 @@ var Controller = require('./../src/index.js'); | ||
test.ok(signal); | ||
console.log(signal); | ||
test.equal(signal.signalName, 'test'); | ||
@@ -52,4 +51,4 @@ test.done(); | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output.foo({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output.foo({foo: 'bar'}); | ||
}; | ||
@@ -59,4 +58,4 @@ action.outputs = ['foo']; | ||
action, { | ||
foo: [function (input) { | ||
test.deepEqual(input, {foo: 'bar'}); | ||
foo: [function (args) { | ||
test.deepEqual(args.input, {foo: 'bar'}); | ||
test.done(); | ||
@@ -72,4 +71,4 @@ }] | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -81,4 +80,4 @@ action.defaultOutput = 'bar'; | ||
foo: [], | ||
bar: [function (input) { | ||
test.deepEqual(input, {foo: 'bar'}); | ||
bar: [function (args) { | ||
test.deepEqual(args.input, {foo: 'bar'}); | ||
test.done(); | ||
@@ -95,4 +94,4 @@ }] | ||
var ctrl = Controller(Model()); | ||
var action = function MyAction (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function MyAction (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -112,4 +111,4 @@ action.outputs = ['foo', 'bar']; | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -130,4 +129,4 @@ action.outputs = ['foo', 'bar']; | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -151,4 +150,4 @@ action.outputs = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output(); | ||
var action = function (args) { | ||
args.output(); | ||
}; | ||
@@ -173,4 +172,4 @@ action.output = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: false}); | ||
var action = function (args) { | ||
args.output({foo: false}); | ||
}; | ||
@@ -194,4 +193,4 @@ action.output = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -218,4 +217,4 @@ action.outputs = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output({foo: 'bar'}); | ||
var action = function (args) { | ||
args.output({foo: 'bar'}); | ||
}; | ||
@@ -240,4 +239,4 @@ action.output = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output.foo({bar: 'bar'}); | ||
var action = function (args) { | ||
args.output.foo({bar: 'bar'}); | ||
}; | ||
@@ -265,4 +264,4 @@ action.outputs = { | ||
var signal = [ | ||
function (input) { | ||
test.deepEqual(input, {foo: 'bar'}); | ||
function (args) { | ||
test.deepEqual(args.input, {foo: 'bar'}); | ||
test.done(); | ||
@@ -279,8 +278,8 @@ } | ||
var signal = [ | ||
function (input, state, output) { | ||
output({ | ||
function (args) { | ||
args.output({ | ||
result: true | ||
}); | ||
}, function (input) { | ||
test.ok(input.result); | ||
}, function (args) { | ||
test.ok(args.input.result); | ||
test.done(); | ||
@@ -297,10 +296,10 @@ } | ||
var signal = [ | ||
[function (input, state, output) { | ||
[function (args) { | ||
async(function () { | ||
output({ | ||
args.output({ | ||
result: true | ||
}); | ||
}); | ||
}], function (input) { | ||
test.ok(input.result); | ||
}], function (args) { | ||
test.ok(args.input.result); | ||
test.done(); | ||
@@ -318,7 +317,7 @@ } | ||
var signal = [ | ||
[function (input, state, output) { | ||
output.success(); | ||
}, {success: []}, function (input, state, output) { | ||
output.success(); | ||
}, {success: []}], function (input) { | ||
[function (args) { | ||
args.output.success(); | ||
}, {success: []}, function (args) { | ||
args.output.success(); | ||
}, {success: []}], function () { | ||
test.equal(changeCount, 3); | ||
@@ -339,7 +338,7 @@ test.done(); | ||
var signal = [ | ||
function (input, state, output) { | ||
output.success({result: true}); | ||
function (args) { | ||
args.output.success({result: true}); | ||
}, { | ||
'success': [function (input) { | ||
test.ok(input.result); | ||
'success': [function (args) { | ||
test.ok(args.input.result); | ||
test.done(); | ||
@@ -357,7 +356,7 @@ }] | ||
var signal = [ | ||
function (input, state, output) { | ||
output.error({result: true}); | ||
function (args) { | ||
args.output.error({result: true}); | ||
}, { | ||
'error': [function (input) { | ||
test.ok(input.result); | ||
'error': [function (args) { | ||
test.ok(args.input.result); | ||
test.done(); | ||
@@ -375,7 +374,7 @@ }] | ||
var signal = [ | ||
[function (input, state, output) { | ||
output.success({result: true}); | ||
[function (args) { | ||
args.output.success({result: true}); | ||
}, { | ||
'success': [function (input) { | ||
test.ok(input.result); | ||
'success': [function (args) { | ||
test.ok(args.input.result); | ||
test.done(); | ||
@@ -393,5 +392,5 @@ }] | ||
var signal = [ | ||
function (input, state) { | ||
test.ok(typeof state.get === 'function'); | ||
test.ok(typeof state.set === 'function'); | ||
function (args) { | ||
test.ok(typeof args.state.get === 'function'); | ||
test.ok(typeof args.state.set === 'function'); | ||
test.done(); | ||
@@ -408,12 +407,12 @@ } | ||
var signal = [ | ||
[function (input, state, output) { | ||
output({ | ||
[function (args) { | ||
args.output({ | ||
foo: true | ||
}); | ||
}, function (input, state, output) { | ||
output({ | ||
}, function (args) { | ||
args.output({ | ||
bar: true | ||
}); | ||
}], function (input) { | ||
test.deepEqual(input, {foo: true, bar: true}); | ||
}], function (args) { | ||
test.deepEqual(args.input, {foo: true, bar: true}); | ||
test.done(); | ||
@@ -432,18 +431,18 @@ } | ||
[ | ||
function (input, state, output) { | ||
output.success({ | ||
function (args) { | ||
args.output.success({ | ||
foo: true | ||
}); | ||
}, { | ||
'success': [function (input) { | ||
results.push(input); | ||
'success': [function (args) { | ||
results.push(args.input); | ||
}], | ||
}, | ||
function (input, state, output) { | ||
output.error({ | ||
function (args) { | ||
args.output.error({ | ||
bar: true | ||
}); | ||
}, { | ||
'error': [function (input) { | ||
results.push(input); | ||
'error': [function (args) { | ||
results.push(args.input); | ||
}] | ||
@@ -475,5 +474,5 @@ } | ||
[ | ||
function (input, state, output) { | ||
function (args) { | ||
async(function () { | ||
output.success({ | ||
args.output.success({ | ||
value: 'foo' | ||
@@ -483,13 +482,13 @@ }); | ||
}, { | ||
'success': [function (input) { | ||
results.push(input.value); | ||
'success': [function (args) { | ||
results.push(args.input.value); | ||
}], | ||
}, | ||
function (input, state, output) { | ||
output.error({ | ||
function (args) { | ||
args.output.error({ | ||
value: 'bar' | ||
}); | ||
}, { | ||
'error': [function (input) { | ||
results.push(input.value); | ||
'error': [function (args) { | ||
results.push(args.input.value); | ||
}] | ||
@@ -515,5 +514,5 @@ } | ||
[ | ||
function (input, state, output) { | ||
function (args) { | ||
async(function () { | ||
output.success({ | ||
args.output.success({ | ||
value: 'foo' | ||
@@ -525,5 +524,5 @@ }); | ||
[ | ||
function (input, state, output) { | ||
results.push(input.value); | ||
output(); | ||
function (args) { | ||
results.push(args.input.value); | ||
args.output(); | ||
} | ||
@@ -549,5 +548,5 @@ ] | ||
var signal = [ | ||
[function (input, state) { | ||
[function (args) { | ||
test.throws(function () { | ||
state.set('foo', 'bar'); | ||
args.state.set('foo', 'bar'); | ||
}); | ||
@@ -567,5 +566,5 @@ test.done(); | ||
var signal = [ | ||
function (input, state, output, services) { | ||
test.ok(services.foo); | ||
test.ok(services.recorder); | ||
function (args) { | ||
test.ok(args.services.foo); | ||
test.ok(args.services.recorder); | ||
test.done(); | ||
@@ -618,4 +617,4 @@ } | ||
var signal = [ | ||
function (input, state, output) { | ||
output(); | ||
function (args) { | ||
args.output(); | ||
}, action | ||
@@ -643,4 +642,4 @@ ]; | ||
var ctrl = Controller(Model()); | ||
var action = function (input) { | ||
test.equal(input.foo, 'bar'); | ||
var action = function (args) { | ||
test.equal(args.input.foo, 'bar'); | ||
}; | ||
@@ -660,5 +659,5 @@ action.defaultInput = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
test.equal(input.foo, 'bar'); | ||
output(); | ||
var action = function (args) { | ||
test.equal(args.input.foo, 'bar'); | ||
args.output(); | ||
}; | ||
@@ -684,4 +683,4 @@ action.defaultInput = { | ||
var ctrl = Controller(Model()); | ||
var action = function (input, state, output) { | ||
output.success(); | ||
var action = function (args) { | ||
args.output.success(); | ||
}; | ||
@@ -688,0 +687,0 @@ var signal = [ |
@@ -99,4 +99,4 @@ var Controller = require('./../src/index.js'); | ||
var signal = [ | ||
function ActionA (args, state) { | ||
state.set('foo', 'bar'); | ||
function ActionA (args) { | ||
args.state.set('foo', 'bar'); | ||
} | ||
@@ -124,4 +124,4 @@ ]; | ||
var signalSync = [ | ||
function ActionA (input, state) { | ||
state.set('foo', 'bar'); | ||
function ActionA (args) { | ||
args.state.set('foo', 'bar'); | ||
} | ||
@@ -132,6 +132,6 @@ ]; | ||
var signalAsync = [ | ||
[function ActionB (input, state, output) { | ||
output(); | ||
}], function ActionC (args, state) { | ||
state.set('foo', 'bar'); | ||
[function ActionB (args) { | ||
args.output(); | ||
}], function ActionC (args) { | ||
args.state.set('foo', 'bar'); | ||
@@ -164,4 +164,4 @@ async(function () { | ||
var signal = [ | ||
[function ActionA (input, state, output) { | ||
output(); | ||
[function ActionA (args) { | ||
args.output(); | ||
}], function () { | ||
@@ -182,5 +182,5 @@ async(function () { | ||
var signal = [ | ||
[function (input, state, output) { | ||
[function (args) { | ||
test.ok(ctrl.store.isExecutingAsync()); | ||
output(); | ||
args.output(); | ||
}] | ||
@@ -222,4 +222,4 @@ ]; | ||
var signal = [ | ||
function (args, state) { | ||
state.set('foo', args.foo); | ||
function (args) { | ||
args.state.set('foo', args.input.foo); | ||
} | ||
@@ -271,8 +271,8 @@ ]; | ||
var signal = [ | ||
[function ActionA (input, state, output) { | ||
output({ | ||
result: input.foo | ||
[function ActionA (args) { | ||
args.output({ | ||
result: args.input.foo | ||
}); | ||
}], function ActionB (input, state) { | ||
state.set('foo', input.result); | ||
}], function ActionB (args) { | ||
args.state.set('foo', args.input.result); | ||
} | ||
@@ -279,0 +279,0 @@ ]; |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is not supported yet
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
Environment variable access
Supply chain riskPackage accesses environment variables, which may be a sign of credential stuffing or data theft.
Found 1 instance in 1 package
Long strings
Supply chain riskContains long string literals, which may be a sign of obfuscated or packed code.
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
Dynamic require
Supply chain riskDynamic require can indicate the package is performing dangerous or unsafe dynamic code execution.
Found 1 instance in 1 package
84
2423711
28715
308