Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.

Commit d5c6b39

Browse files
committed
Merge pull request #10 from purescript-contrib/next
Library expansion
2 parents 8582dec + 78dfefb commit d5c6b39

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

66 files changed

+4256
-138
lines changed

bower.json

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,12 @@
1818
"bower.json",
1919
"gulpfile.js",
2020
"package.json"
21-
]
21+
],
22+
"dependencies": {
23+
"purescript-unsafe-coerce": "^0.1.0",
24+
"purescript-enums": "^0.7.0",
25+
"purescript-foreign": "^0.7.0",
26+
"purescript-exceptions": "~0.3.0",
27+
"purescript-nullable": "~0.2.1"
28+
}
2229
}

docs/DOM.md

Lines changed: 2 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -6,30 +6,7 @@
66
data DOM :: !
77
```
88

9-
Effect type for DOM maniupulation
10-
11-
#### `Document`
12-
13-
``` purescript
14-
data Document :: *
15-
```
16-
17-
General type for DOM documents.
18-
19-
#### `Node`
20-
21-
``` purescript
22-
data Node :: *
23-
```
24-
25-
General type for DOM nodes.
26-
27-
#### `NodeList`
28-
29-
``` purescript
30-
data NodeList :: *
31-
```
32-
33-
General type for DOM node lists.
9+
Effect type for when the DOM is being manipulated or mutable values are
10+
being read from the DOM.
3411

3512

docs/DOM/Event/Event.md

Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
## Module DOM.Event.Event
2+
3+
#### `type_`
4+
5+
``` purescript
6+
type_ :: Event -> EventType
7+
```
8+
9+
The event type.
10+
11+
#### `target`
12+
13+
``` purescript
14+
target :: Event -> Node
15+
```
16+
17+
The element that was the source of the event.
18+
19+
#### `currentTarget`
20+
21+
``` purescript
22+
currentTarget :: Event -> Node
23+
```
24+
25+
The element that the event listener was added to.
26+
27+
#### `eventPhase`
28+
29+
``` purescript
30+
eventPhase :: Event -> EventPhase
31+
```
32+
33+
Indicates which phase of the event flow that is currently being processed
34+
for the event.
35+
36+
#### `eventPhaseIndex`
37+
38+
``` purescript
39+
eventPhaseIndex :: Event -> Int
40+
```
41+
42+
The integer value for the current event phase.
43+
44+
#### `stopPropagation`
45+
46+
``` purescript
47+
stopPropagation :: Event -> Eff (dom :: DOM) Unit
48+
```
49+
50+
Prevents the event from bubbling up to futher event listeners. Other event
51+
listeners on the current target will still fire.
52+
53+
#### `stopImmediatePropagation`
54+
55+
``` purescript
56+
stopImmediatePropagation :: Event -> Eff (dom :: DOM) Unit
57+
```
58+
59+
Prevents all other listeners for the event from being called. This includes
60+
event listeners added to the current target after the current listener.
61+
62+
#### `bubbles`
63+
64+
``` purescript
65+
bubbles :: Event -> Boolean
66+
```
67+
68+
Indicates whether the event will bubble up through the DOM or not.
69+
70+
#### `cancelable`
71+
72+
``` purescript
73+
cancelable :: Event -> Boolean
74+
```
75+
76+
Indicates whether the event can be cancelled.
77+
78+
#### `preventDefault`
79+
80+
``` purescript
81+
preventDefault :: Event -> Eff (dom :: DOM) Unit
82+
```
83+
84+
Cancels the event if it can be cancelled.
85+
86+
#### `defaultPrevented`
87+
88+
``` purescript
89+
defaultPrevented :: Event -> Boolean
90+
```
91+
92+
Indicates whether `preventDefault` was called on the event.
93+
94+
#### `timeStamp`
95+
96+
``` purescript
97+
timeStamp :: Event -> Number
98+
```
99+
100+
The time in milliseconds between 01/01/1970 and when the event was
101+
dispatched.
102+
103+

docs/DOM/Event/EventPhase.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
## Module DOM.Event.EventPhase
2+
3+
#### `EventPhase`
4+
5+
``` purescript
6+
data EventPhase
7+
= None
8+
| Capturing
9+
| AtTarget
10+
| Bubbling
11+
```
12+
13+
##### Instances
14+
``` purescript
15+
instance eqEventPhase :: Eq EventPhase
16+
instance ordEventPhase :: Ord EventPhase
17+
instance boundedEventPhase :: Bounded EventPhase
18+
instance boundedOrdEventPhase :: BoundedOrd EventPhase
19+
instance enumEventPhase :: Enum EventPhase
20+
```
21+
22+

docs/DOM/Event/EventTarget.md

Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
## Module DOM.Event.EventTarget
2+
3+
#### `EventListener`
4+
5+
``` purescript
6+
data EventListener :: # ! -> *
7+
```
8+
9+
A boxed function that can be used as an event listener. This is necessary
10+
due to the underling implementation of Eff functions.
11+
12+
#### `eventListener`
13+
14+
``` purescript
15+
eventListener :: forall eff a. (Event -> Eff (dom :: DOM) a) -> EventListener eff
16+
```
17+
18+
Creates an EventListener from a normal PureScript Eff function.
19+
20+
#### `addEventListener`
21+
22+
``` purescript
23+
addEventListener :: forall eff. EventType -> EventListener eff -> Boolean -> EventTarget -> Eff (dom :: DOM | eff) Unit
24+
```
25+
26+
Adds a listener to an event target. The boolean argument indicates whether
27+
the listener should be added for the "capture" phase.
28+
29+
#### `removeEventListener`
30+
31+
``` purescript
32+
removeEventListener :: forall eff. EventType -> EventListener eff -> Boolean -> EventTarget -> Eff (dom :: DOM | eff) Unit
33+
```
34+
35+
Removes a listener to an event target. The boolean argument indicates
36+
whether the listener should be removed for the "capture" phase.
37+
38+
#### `dispatchEvent`
39+
40+
``` purescript
41+
dispatchEvent :: forall eff. Event -> EventTarget -> Eff (dom :: DOM, err :: EXCEPTION | eff) Boolean
42+
```
43+
44+
Dispatches an event from an event target.
45+
46+

0 commit comments

Comments
 (0)