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

Pass command helper to command's eject method #192

Open
mwistrand opened this issue Jan 4, 2018 · 0 comments
Open

Pass command helper to command's eject method #192

mwistrand opened this issue Jan 4, 2018 · 0 comments

Comments

@mwistrand
Copy link
Contributor

Bug

eject is currently treated as a command rather than an operation on commands, and as such any given command's eject method is passed a unique Helper rather than that associated with the command. As a result, it is not possible to access the command's options in the dojorc, as the helper's configuration uses eject as its internal key, so helper.configuration.get() actually reads from the non-existent eject key. This also means that calling helper.configuration.set() from within eject methods across commands results in multiple writes to the same object.

Package Version:

Code

// dojorc
{
    "my-command": {
          "hello": "world"
    }
}

```typescript
eject(helper: Helper) {
    console.log(helper.configuration.get());
    helper.configuration.set({ "hello": "dojo 2 world" });
}

Expected behavior:

{ "hello": "world" } is logged to the console and the dojorc is updated to:

{
    "my-command": { "hello": "dojo 2 world" }
}

Actual behavior:

{} is logged to the console as there is no eject key, and the dojorc is updated to:

{
    "my-command": { "hello": "world" },
    "eject": { "hello": "dojo 2 world" }
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants