Skip to content
This repository has been archived by the owner on Apr 23, 2020. It is now read-only.

Kill the awful “double call” syntax #99

Open
MattiSG opened this issue Sep 12, 2013 · 1 comment
Open

Kill the awful “double call” syntax #99

MattiSG opened this issue Sep 12, 2013 · 1 comment
Assignees
Milestone

Comments

@MattiSG
Copy link
Owner

MattiSG commented Sep 12, 2013

Currently, actions have to be called twice when used in other actions:

lookup: function(country) {
    return  this.setSelector(country)() // <-- this
                .then(this.submit());
}

This is awful. We need to have something cleaner.

Possible solutions, by order of preference:

  1. Add a then property to action wrappers, so that it becomes transparent. See branch experimental-no-double-call.
  2. Give all widgets a magic chain/start… property that returns an already-resolved promise and starts the chain. The main question is about the name itself.
@MattiSG MattiSG added this to the v1.0 milestone Sep 21, 2015
@MattiSG MattiSG added the Major label Sep 21, 2015
@MattiSG
Copy link
Owner Author

MattiSG commented Sep 21, 2015

Implementation idea: make an external module that abstracts calling an array of promise-returning functions sequentially OR a promise-returning function, and use that in every instance where the user could provide a sequence of actions (custom actions in components, feature scenarios).

Allows both readability (use an array, get rid of return and then and their tricks) and extendability (use your own promise-returning function, up to you to ensure you don't forget proper return handling).

@MattiSG MattiSG self-assigned this Sep 21, 2015
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant