stamen / modestmaps-js

Modest Maps javascript port
http://modestmaps.com
566 stars 152 forks source link

node example broken? #122

Closed gonzoramos closed 12 years ago

gonzoramos commented 12 years ago

It seems to complain about not being able to find a definition to 'window' in line 1056 of modestmaps.js

shawnbot commented 12 years ago

Yeah, the HAS_HASHCHANGE bit assumes a variable called window. We'll have to add a clause there to short-circuit when window is undefined.

gonzoramos commented 12 years ago

so something like

if (window != undefined) { ... }

when appropriate?

shawnbot commented 12 years ago

Yeah, something like that. The whole Hash class is pretty much irrelevant if you don't have a window, so you could just wrap the whole definition in:

if (typeof window !== "undefined") {
    ...
}
tmcw commented 12 years ago

@shawnbot I'm thinking that MM.Hash should be a candidate for modestmaps-ui, which would be more neatly separated as a non-server part here. Thoughts?

tmcw commented 12 years ago

MM.Hash is removed in modestmaps/modestmaps-js.