Skip to content

Instantly share code, notes, and snippets.

@mattwagl
Last active June 25, 2018 10:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mattwagl/38b45b2c19a85081c06d1e9c39f82837 to your computer and use it in GitHub Desktop.
Save mattwagl/38b45b2c19a85081c06d1e9c39f82837 to your computer and use it in GitHub Desktop.
wolkenkit sample application.
const when = {
'collaboration.board.mounted' (boards, event, mark) {
boards.add({
title: event.data.title,
slug: event.data.slug,
timestamp: event.metadata.timestamp
});
mark.asDone();
}
};
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