Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(command): attach command to previous undo/redo context #535

Draft
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

nikku
Copy link
Member

@nikku nikku commented Feb 27, 2021

This adds the ability to attach commands to the previous undo/redo context.

By doing so I can execute things invisible to the user (from the undo/redo) perspective.

// given
commandStack.registerHandler('simple-command', SimpleCommand);

var context = { element: { trace: [] } };

commandStack.execute('simple-command', context, true);
commandStack.execute('simple-command', context, true);

// when
commandStack.undo();

// then
// both commands are undone

This adds the ability to attach commands to the previous undo/redo
context.

By doing so I can execute things invisible to the user (from the
undo/redo) perspective.

```javascript
// given
commandStack.registerHandler('simple-command', SimpleCommand);

var context = { element: { trace: [] } };

commandStack.execute('simple-command', context, true);
commandStack.execute('simple-command', context, true);

// when
commandStack.undo();

// then
// both commands are undone
```
@bpmn-io-tasks bpmn-io-tasks bot added the in progress Currently worked on label Feb 27, 2021
@nikku nikku added backlog Queued in backlog and removed in progress Currently worked on labels Feb 27, 2021
@nikku nikku self-assigned this Feb 27, 2021
@philippfromme
Copy link
Contributor

Looks interesting, let me know if you think we should move forward with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backlog Queued in backlog
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants