Leaflet.utfgrid icon indicating copy to clipboard operation
Leaflet.utfgrid copied to clipboard

initialize function issue

Open gete76 opened this issue 10 years ago • 5 comments

Not sure if this is really a bug but more to do with intention. I noticed the new changes now load the Utfgrid with 'this' as the parameter to be passed for the window parameter. Passing 'this' assumes that in the context of loading this file that 'this' is the window object or some other object with global functions. I now get a window.setTimeout is not function because I load Utfgrid into a browserify module and 'this' is definitely not the window object in its context. What's the purpose of passing 'this' and not 'window' in the wrapper function?

gete76 avatar Aug 21 '15 19:08 gete76

When did we change this?

danzel avatar Aug 21 '15 23:08 danzel

My apologies, I read the diff history wrong. I did pull down changes today. Though I'm still trying to understand what broke. The _process_request function in dist/leaflet.utfgrid.js throws a window.setTimeout is not a function. I found that 'this' passed as the parameter in the loading function is not the window object or global context as expected according to the code. Though this worked fine before when loaded in a browserify module. Any ideas? My own solution was to just change 'this' to 'window' .

gete76 avatar Aug 21 '15 23:08 gete76

Might have been #28

danzel avatar Aug 22 '15 01:08 danzel

Is it okay if I submit a pull request for this?

gete76 avatar Aug 23 '15 21:08 gete76

Yeah please do

danzel avatar Aug 23 '15 21:08 danzel