This repository was archived by the owner on Oct 4, 2020. It is now read-only.
File tree Expand file tree Collapse file tree 5 files changed +85
-0
lines changed Expand file tree Collapse file tree 5 files changed +85
-0
lines changed Original file line number Diff line number Diff line change
1
+ /* global exports */
2
+ "use strict" ;
3
+
4
+ // module DOM.HTML.Location
5
+
6
+ exports . hash = function ( location ) {
7
+ return function ( ) {
8
+ return location . hash ;
9
+ } ;
10
+ } ;
11
+
12
+ exports . host = function ( location ) {
13
+ return function ( ) {
14
+ return location . host ;
15
+ } ;
16
+ } ;
17
+
18
+ exports . hostname = function ( location ) {
19
+ return function ( ) {
20
+ return location . hostname ;
21
+ } ;
22
+ } ;
23
+
24
+ exports . href = function ( location ) {
25
+ return function ( ) {
26
+ return location . href ;
27
+ } ;
28
+ } ;
29
+
30
+ exports . origin = function ( location ) {
31
+ return function ( ) {
32
+ return location . origin ;
33
+ } ;
34
+ } ;
35
+
36
+ exports . pathname = function ( location ) {
37
+ return function ( ) {
38
+ return location . pathname ;
39
+ } ;
40
+ } ;
41
+
42
+ exports . port = function ( location ) {
43
+ return function ( ) {
44
+ return location . port ;
45
+ } ;
46
+ } ;
47
+
48
+ exports . protocol = function ( location ) {
49
+ return function ( ) {
50
+ return location . protocol ;
51
+ } ;
52
+ } ;
53
+
54
+ exports . search = function ( location ) {
55
+ return function ( ) {
56
+ return location . search ;
57
+ } ;
58
+ } ;
Original file line number Diff line number Diff line change
1
+ module DOM.HTML.Location where
2
+
3
+ import Control.Monad.Eff (Eff ())
4
+
5
+ import DOM
6
+ import DOM.HTML.Types
7
+
8
+ foreign import hash :: forall eff . Location -> Eff (dom :: DOM | eff ) String
9
+ foreign import host :: forall eff . Location -> Eff (dom :: DOM | eff ) String
10
+ foreign import hostname :: forall eff . Location -> Eff (dom :: DOM | eff ) String
11
+ foreign import href :: forall eff . Location -> Eff (dom :: DOM | eff ) String
12
+ foreign import origin :: forall eff . Location -> Eff (dom :: DOM | eff ) String
13
+ foreign import pathname :: forall eff . Location -> Eff (dom :: DOM | eff ) String
14
+ foreign import port :: forall eff . Location -> Eff (dom :: DOM | eff ) String
15
+ foreign import protocol :: forall eff . Location -> Eff (dom :: DOM | eff ) String
16
+ foreign import search :: forall eff . Location -> Eff (dom :: DOM | eff ) String
Original file line number Diff line number Diff line change @@ -17,6 +17,7 @@ module DOM.HTML.Types
17
17
, htmlElementToNode
18
18
, htmlElementToEventTarget
19
19
, readHTMLElement
20
+ , Location ()
20
21
) where
21
22
22
23
import Prelude
@@ -84,3 +85,5 @@ readHTMLElement = _readHTMLElement (Left <<< TypeMismatch "HTMLElement") Right
84
85
85
86
instance isForeignHTMLElement :: IsForeign HTMLElement where
86
87
read = readHTMLElement
88
+
89
+ foreign import data Location :: *
Original file line number Diff line number Diff line change @@ -14,3 +14,9 @@ exports.navigator = function (window) {
14
14
return window . navigator ;
15
15
} ;
16
16
} ;
17
+
18
+ exports . location = function ( window ) {
19
+ return function ( ) {
20
+ return window . location ;
21
+ } ;
22
+ } ;
Original file line number Diff line number Diff line change @@ -8,3 +8,5 @@ import DOM.HTML.Types
8
8
foreign import document :: forall eff . Window -> Eff (dom :: DOM | eff ) HTMLDocument
9
9
10
10
foreign import navigator :: forall eff . Window -> Eff (dom :: DOM | eff ) Navigator
11
+
12
+ foreign import location :: forall eff . Window -> Eff (dom :: DOM | eff ) Location
You can’t perform that action at this time.
0 commit comments