linkedom icon indicating copy to clipboard operation
linkedom copied to clipboard

Missing `window.Location` (the constructor)

Open fregante opened this issue 3 years ago • 4 comments

Due to some TypeScript code that uses instanceof Location to tell an argument apart from other types of URLs, I'd need this global class. I was unable to locate where exactly the location property is generated in this codebase.

fregante avatar Sep 09 '22 16:09 fregante

there's no location here ... it's SSR: you define the location? add a global class would be my answer but that might not solve, right?

WebReflection avatar Sep 09 '22 22:09 WebReflection

This is not a location?

const {window} = parseHTML('')
window.location

I'm just asking window.location to be an instance of window.Location, which currently doesn't exist in the first place.

I already know what a workaround would be, I'm suggesting to add a class so that I don't need to work around this.

If it doesn't belong to linkedom because you want to keep it light, that's fair.

fregante avatar Sep 10 '22 03:09 fregante

If location is exposed (can’t remember, sorry) then it’s ok to expose Location class.

mind filing a PR?

WebReflection avatar Sep 10 '22 07:09 WebReflection

actually ... tests show that location is something you pass along, so you can add Location globally, or should I check if location is available (passed) and return its proto constructor?

WebReflection avatar Sep 16 '22 08:09 WebReflection

Closing as no interest shown whatsoever for more than a month.

WebReflection avatar Oct 27 '22 20:10 WebReflection