I think that would be better done the way I've handled things like isFinite/isNaN for my branch where we would have declared in the haxe closure var $window = window; instead, and only when js.Browser.window is actually accessed.