diff --git a/src/history.js b/src/history.js index 86f100a6e..8163382c3 100644 --- a/src/history.js +++ b/src/history.js @@ -61,6 +61,20 @@ class Location { toString() { return this._url; } + + toJSON() { + return { + hostname: this.hostname, + href: this.href, + origin: this.origin, + hash: this.hash, + host: this.host, + pathname: this.pathname, + port: this.port, + protocol: this.protocol, + search: this.search + } + } get hostname() { return URL.parse(this._url).hostname;