add addTo function to Handler (#5930)

This commit is contained in:
Andrew 2017-11-27 18:40:14 +01:00 committed by Vladimir Agafonkin
parent b22ca31716
commit 30d7b8997d
2 changed files with 8 additions and 1 deletions

View File

@ -47,3 +47,11 @@ export var Handler = Class.extend({
// @method removeHooks()
// Called when the handler is disabled, should remove the event hooks added previously.
});
// @section There is static function which can be called without instantiating L.Handler:
// @function addTo(map: Map, name: String): this
// Adds a new Handler to the given map with the given name.
Handler.addTo = function (map, name) {
map.addHandler(name, this);
return this;
};

View File

@ -682,7 +682,6 @@ export var Map = Evented.extend({
this.fire('locationfound', data);
},
// TODO handler.addTo
// TODO Appropriate docs section?
// @section Other Methods
// @method addHandler(name: String, HandlerClass: Function): this