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

return value of L.Handler.addTo() #6625

Open
johnd0e opened this issue Apr 26, 2019 · 0 comments
Open

return value of L.Handler.addTo() #6625

johnd0e opened this issue Apr 26, 2019 · 0 comments

Comments

@johnd0e
Copy link
Collaborator

johnd0e commented Apr 26, 2019

Is your feature request related to a problem? Please describe.

There is static function which can be called without instantiating L.Handler
addTo(<Map> map, <String> name)

Returns: this

This method return class, not instance.
I could be wrong, but I can make the only use case: add same handler to several maps at once, like myHandler.addTo(map1,'someHandler').addTo(map2,'someHandler').addTo(map3,'someHandler');
Not very useful, IMHO.

Describe the solution you'd like
I suppose that more useful would be to return instance here, to be able to call later it's methods:

var handlerInstance = `myHandler.addTo(map,'someHandler');

Describe alternatives you've considered

map.addHandler('someHandler', myHandler);
var handlerInstance = map.someHandler;

This works, but a bit ugly.

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

1 participant