Last active
June 25, 2018 10:26
-
-
Save mattwagl/38b45b2c19a85081c06d1e9c39f82837 to your computer and use it in GitHub Desktop.
wolkenkit sample application.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const when = { | |
'collaboration.board.mounted' (boards, event, mark) { | |
boards.add({ | |
title: event.data.title, | |
slug: event.data.slug, | |
timestamp: event.metadata.timestamp | |
}); | |
mark.asDone(); | |
} | |
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const initialState = { | |
title: undefined, | |
slug: undefined | |
}; | |
const commands = { | |
mount (board, command, mark) { | |
if (command.data.title === undefined) { | |
mark.asRejected('Title is missing.'); | |
return; | |
} | |
board.events.publish('mounted', { | |
title: command.data.title, | |
slug: slugify(command.data.title) | |
}); | |
mark.asDone(); | |
} | |
}; | |
const events = { | |
mounted (board, command) { | |
board.setState({ | |
title: command.data.title, | |
slug: command.data.slug | |
}) | |
} | |
}; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment