danzel / Leaflet.utfgrid

A UTFGrid implementation for leaflet that is super small.
MIT License
131 stars 51 forks source link

initialize function issue #40

Open gete76 opened 9 years ago

gete76 commented 9 years ago

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?

danzel commented 9 years ago

When did we change this?

gete76 commented 9 years ago

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' .

danzel commented 9 years ago

Might have been #28

gete76 commented 9 years ago

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

danzel commented 9 years ago

Yeah please do