Skip to content
This repository was archived by the owner on Oct 4, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,5 +18,12 @@
"bower.json",
"gulpfile.js",
"package.json"
]
],
"dependencies": {
"purescript-unsafe-coerce": "^0.1.0",
"purescript-enums": "^0.7.0",
"purescript-foreign": "^0.7.0",
"purescript-exceptions": "~0.3.0",
"purescript-nullable": "~0.2.1"
}
}
27 changes: 2 additions & 25 deletions docs/DOM.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,30 +6,7 @@
data DOM :: !
```

Effect type for DOM maniupulation

#### `Document`

``` purescript
data Document :: *
```

General type for DOM documents.

#### `Node`

``` purescript
data Node :: *
```

General type for DOM nodes.

#### `NodeList`

``` purescript
data NodeList :: *
```

General type for DOM node lists.
Effect type for when the DOM is being manipulated or mutable values are
being read from the DOM.


103 changes: 103 additions & 0 deletions docs/DOM/Event/Event.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
## Module DOM.Event.Event

#### `type_`

``` purescript
type_ :: Event -> EventType
```

The event type.

#### `target`

``` purescript
target :: Event -> Node
```

The element that was the source of the event.

#### `currentTarget`

``` purescript
currentTarget :: Event -> Node
```

The element that the event listener was added to.

#### `eventPhase`

``` purescript
eventPhase :: Event -> EventPhase
```

Indicates which phase of the event flow that is currently being processed
for the event.

#### `eventPhaseIndex`

``` purescript
eventPhaseIndex :: Event -> Int
```

The integer value for the current event phase.

#### `stopPropagation`

``` purescript
stopPropagation :: Event -> Eff (dom :: DOM) Unit
```

Prevents the event from bubbling up to futher event listeners. Other event
listeners on the current target will still fire.

#### `stopImmediatePropagation`

``` purescript
stopImmediatePropagation :: Event -> Eff (dom :: DOM) Unit
```

Prevents all other listeners for the event from being called. This includes
event listeners added to the current target after the current listener.

#### `bubbles`

``` purescript
bubbles :: Event -> Boolean
```

Indicates whether the event will bubble up through the DOM or not.

#### `cancelable`

``` purescript
cancelable :: Event -> Boolean
```

Indicates whether the event can be cancelled.

#### `preventDefault`

``` purescript
preventDefault :: Event -> Eff (dom :: DOM) Unit
```

Cancels the event if it can be cancelled.

#### `defaultPrevented`

``` purescript
defaultPrevented :: Event -> Boolean
```

Indicates whether `preventDefault` was called on the event.

#### `timeStamp`

``` purescript
timeStamp :: Event -> Number
```

The time in milliseconds between 01/01/1970 and when the event was
dispatched.


22 changes: 22 additions & 0 deletions docs/DOM/Event/EventPhase.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
## Module DOM.Event.EventPhase

#### `EventPhase`

``` purescript
data EventPhase
= None
| Capturing
| AtTarget
| Bubbling
```

##### Instances
``` purescript
instance eqEventPhase :: Eq EventPhase
instance ordEventPhase :: Ord EventPhase
instance boundedEventPhase :: Bounded EventPhase
instance boundedOrdEventPhase :: BoundedOrd EventPhase
instance enumEventPhase :: Enum EventPhase
```


46 changes: 46 additions & 0 deletions docs/DOM/Event/EventTarget.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
## Module DOM.Event.EventTarget

#### `EventListener`

``` purescript
data EventListener :: # ! -> *
```

A boxed function that can be used as an event listener. This is necessary
due to the underling implementation of Eff functions.

#### `eventListener`

``` purescript
eventListener :: forall eff a. (Event -> Eff (dom :: DOM) a) -> EventListener eff
```

Creates an EventListener from a normal PureScript Eff function.

#### `addEventListener`

``` purescript
addEventListener :: forall eff. EventType -> EventListener eff -> Boolean -> EventTarget -> Eff (dom :: DOM | eff) Unit
```

Adds a listener to an event target. The boolean argument indicates whether
the listener should be added for the "capture" phase.

#### `removeEventListener`

``` purescript
removeEventListener :: forall eff. EventType -> EventListener eff -> Boolean -> EventTarget -> Eff (dom :: DOM | eff) Unit
```

Removes a listener to an event target. The boolean argument indicates
whether the listener should be removed for the "capture" phase.

#### `dispatchEvent`

``` purescript
dispatchEvent :: forall eff. Event -> EventTarget -> Eff (dom :: DOM, err :: EXCEPTION | eff) Boolean
```

Dispatches an event from an event target.


Loading