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

MapContainer whenReady doesn't receive target parameter from Leaflet #1120

Open
BggClr opened this issue Jan 14, 2024 · 2 comments
Open

MapContainer whenReady doesn't receive target parameter from Leaflet #1120

BggClr opened this issue Jan 14, 2024 · 2 comments

Comments

@BggClr
Copy link

BggClr commented Jan 14, 2024

In Leaflet map whenReady event provides map component to whenReady callback as below:

whenReady(callback, context) {
	if (this._loaded) {
		callback.call(context || this, {target: this});
	} else {
		this.on('load', callback, context);
	}
	return this;
}

But MapContainer has whenReady function with no arguments

whenReady?: () => void

Is it possible to add those missing argument to whenReady callback?

@erfurtjohn
Copy link

Ran into the same problem.

@piotr-cz
Copy link

piotr-cz commented Jul 9, 2024

Ideally type definition for whenReady should inherit from @types/leaflet.

Unfortunately it's not typed properly there: https://github.com/DefinitelyTyped/DefinitelyTyped/blob/ab24eb77b6ca96a9aa41066add50b132199aab71/types/leaflet/index.d.ts#L2929

 whenReady(fn: () => void, context?: any): this;

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

No branches or pull requests

3 participants