Skip to content

Commit

Permalink
implement todo
Browse files Browse the repository at this point in the history
  • Loading branch information
customcommander committed Oct 9, 2024
1 parent 4a178ef commit 2c97011
Show file tree
Hide file tree
Showing 2 changed files with 29 additions and 28 deletions.
31 changes: 25 additions & 6 deletions src/lib-task.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,13 @@ const lib = setup({
reply_to
})),

'task-abort':
sendTo(gamesys, (_, {task_id, err}) => ({
type: 'task.aborted',
task_id,
err
})),

'task-ack':
sendTo(dispatcher, {type: 'task.ack'}),

Expand All @@ -40,6 +47,7 @@ export default function (definitions) {
id,
replenish,
selection,
todo
} = definitions;

const m = {
Expand Down Expand Up @@ -100,13 +108,24 @@ export default function (definitions) {
},

execute: {
entry: {
type: 'game-update',
params: {
fn: execute,
reply_to: id
entry: (
todo ?
{
type: 'task-abort',
params: {
err: 'TODO',
task_id: id
}
}
},
: //
{
type: 'game-update',
params: {
fn: execute,
reply_to: id
}
}
),
on: {
'game.updated': {
target: 'idle',
Expand Down
26 changes: 4 additions & 22 deletions src/task-102.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,28 +6,10 @@
*/

import {
base
} from './task-lib.js';
import task from './lib-task.js';

const machine = base.createMachine({
initial: 'idle',
states: {
idle: {
on: {
'task.selected': {
actions: {
type: 'abort',
params: {
task_id: 102,
err: 'TODO'
}
}
}
}
}
}
export default task({
id: '102',
todo: true
});

export default machine;

0 comments on commit 2c97011

Please sign in to comment.