Last active
September 13, 2023 14:00
-
-
Save jgphilpott/68e9e22ea6ac5bf44ff7a86ef75b5e5d to your computer and use it in GitHub Desktop.
Revisions
-
jgphilpott revised this gist
Sep 13, 2023 . 1 changed file with 1 addition and 0 deletions.There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -3,6 +3,7 @@ var Page; Page = class Page { constructor() { this.url = window.location; } -
jgphilpott created this gist
Sep 13, 2023 .There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,31 @@ # Credit: https://www.w3schools.com/js/js_window_location.asp class Page constructor: -> @url = window.location href: -> return this.url.href protocol: -> return this.url.protocol host: -> return this.url.hostname path: -> return this.url.pathname port: -> return this.url.port redirect: (href = "") -> return this.url.assign href This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,34 @@ // Credit: https://www.w3schools.com/js/js_window_location.asp var Page; Page = class Page { constructor() { this.url = window.location; } href() { return this.url.href; } protocol() { return this.url.protocol; } host() { return this.url.hostname; } path() { return this.url.pathname; } port() { return this.url.port; } redirect(href = "") { return this.url.assign(href); } };