ismyrnow / Leaflet.functionaltilelayer

Leaflet tile layer with functionally defined URL and support for promises.
MIT License
72 stars 15 forks source link

`Uncaught TypeError: Object #<Object> has no method 'fire'` #4

Closed sebastianzillessen closed 10 years ago

sebastianzillessen commented 10 years ago

When I try to use your layer with promises I get an error saying:

Uncaught TypeError: Object #<Object> has no method 'fire' leaflet.functional.tilelayer.js:55
(anonymous function) leaflet.functional.tilelayer.js:55
(anonymous function) jquery.js:3069
fire jquery.js:2913 
self.fireWith jquery.js:3025
deferred.(anonymous function) jquery.js:3114

Where should fire come from and what should it exactly do?

Thanks!

ismyrnow commented 10 years ago

Thanks for taking the time to report your issue.

The plugin uses the leaflet defined 'fire' function for firing an event when the tile starts loading, and again after it's loaded. This is code is borrowed from leaflet's standard tile layer.

Can you provide a jsfiddle demonstrating the error? If so, I would be happy to look at it and try to resolve the problem.

On Tuesday, December 10, 2013, Sebastian Zillessen wrote:

When I try to use your layer with promises I get an error saying:

´´´ Uncaught TypeError: Object # has no method 'fire' leaflet.functional.tilelayer.js:55 (anonymous function) leaflet.functional.tilelayer.js:55 (anonymous function) jquery.js:3069 fire jquery.js:2913 self.fireWith jquery.js:3025 deferred.(anonymous function) jquery.js:3114 ´´´

Where should ´fire´ come from and what should it exactly do?

Thanks!

— Reply to this email directly or view it on GitHubhttps://github.com/ismyrnow/Leaflet.functionaltilelayer/issues/4 .

ismyrnow commented 10 years ago

I was able to fix the problem (see a4c672c). The issue was that inside a promise callback, this was no longer referencing the plugin.

Thanks for the heads up!