Update to Prettier 2 and use ES Private Fields (#4498)

This commit is contained in:
Kitson Kelly 2020-03-29 04:03:49 +11:00 committed by GitHub
parent 1397b8e0e7
commit bced52505f
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
329 changed files with 2787 additions and 2430 deletions

View file

@ -1,12 +1,15 @@
// Copyright 2018-2020 the Deno authors. All rights reserved. MIT license.
import { URL } from "./url.ts";
import { notImplemented } from "../util.ts";
import { Location } from "./dom_types.ts";
import { DOMStringList, Location } from "./dom_types.ts";
import { getDOMStringList } from "./dom_util.ts";
export class LocationImpl implements Location {
#url: URL;
constructor(url: string) {
const u = new URL(url);
this.url = u;
this.#url = u;
this.hash = u.hash;
this.host = u.host;
this.href = u.href;
@ -18,13 +21,11 @@ export class LocationImpl implements Location {
this.search = u.search;
}
private url: URL;
toString(): string {
return this.url.toString();
return this.#url.toString();
}
readonly ancestorOrigins: string[] = [];
readonly ancestorOrigins: DOMStringList = getDOMStringList([]);
hash: string;
host: string;
hostname: string;
@ -45,6 +46,8 @@ export class LocationImpl implements Location {
}
}
/** Sets the `window.location` at runtime.
* @internal */
export function setLocation(url: string): void {
globalThis.location = new LocationImpl(url);
Object.freeze(globalThis.location);