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

Refactor tasks and services to accept only options with URL #420

Closed
patrickarlt opened this issue Dec 18, 2014 · 1 comment
Closed

Refactor tasks and services to accept only options with URL #420

patrickarlt opened this issue Dec 18, 2014 · 1 comment
Assignees
Labels

Comments

@patrickarlt
Copy link
Contributor

I had a conversation with @jgravois about this today so I will attempt to transcribe the notes here.

Initializing Tasks and Services with the (url, options) pattern is starting to cause problems that look like horrible kludges in downstream plugins like the geocoder.

This proposed code by @jgravois is pretty indicative of the problem. https://github.com/jgravois/esri-leaflet-geocoder/blob/empty-constructor/src/Tasks/Geocode.js#L28-L41. That code has to check for:

  1. passing a Service as the first param,
  2. passing url and options
  3. passing options and using the default URL

In short we shouldn't have to write code like this. Its much cleaner to make url an option that can be passed in. This means that the first parameter is always either

  1. an options object with url, or no url to use a default URL
  2. a service, in which case we only need to check for the presence of request and switch accordingly

This is a major breaking change but we are still in a release candidate stage of Esri Leaflet now is the time to do this to simplify downstream plugins that want to use a default for URL.

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

Successfully merging a pull request may close this issue.

2 participants