Skip to content

Instantly share code, notes, and snippets.

@mattwagl
Last active July 25, 2018 08:27
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/b5fa022ad3a9ed788e3a68a138111f7e to your computer and use it in GitHub Desktop.
Save mattwagl/b5fa022ad3a9ed788e3a68a138111f7e to your computer and use it in GitHub Desktop.
Simple wolkenkit writeModel.
const initialState = {
title: undefined,
slug: undefined
};
const commands = {
mount (board, command) {
if (command.data.title === undefined) {
command.reject('Title is missing.');
return;
}
board.events.publish('mounted', {
title: command.data.title,
slug: slugify(command.data.title)
});
}
};
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