From ad481ad78f41d5a90a83ac96698a096512f18675 Mon Sep 17 00:00:00 2001 From: Ed Clement Date: Sat, 12 Jan 2019 11:59:48 -0500 Subject: [PATCH] Update history.js add `toJSON` member to `Location` class --- src/history.js | 14 ++++++++++++++ 1 file changed, 14 insertions(+) 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;