Skip to content

Commit

Permalink
Merge pull request #1 from gdotdesign/mailboxed-components
Browse files Browse the repository at this point in the history
Mailboxed components.
  • Loading branch information
gdotdesign committed Jan 11, 2016
2 parents 46513e1 + 8434c64 commit b58fc5c
Show file tree
Hide file tree
Showing 40 changed files with 1,220 additions and 590 deletions.
2 changes: 2 additions & 0 deletions elm-package.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
"Ext.Date",
"Ext.Number",
"Ext.Color",
"Ext.Signal",
"Html.Extra",
"Storage.Local",
"Ui",
Expand Down Expand Up @@ -45,6 +46,7 @@
],
"dependencies": {
"circuithub/elm-number-format": "1.0.2 <= v < 2.0.0",
"circuithub/elm-maybe-extra": "1.5.1 <= v < 2.0.0",
"circuithub/elm-json-extra": "2.2.0 <= v < 3.0.0",
"circuithub/elm-list-extra": "3.7.1 <= v < 4.0.0",
"deadfoxygrandpa/elm-test": "3.0.1 <= v < 4.0.0",
Expand Down
19 changes: 19 additions & 0 deletions source/Ext/Signal.elm
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
module Ext.Signal where

{-| Utility functions for working with signals.
@docs sendAsEffect
-}
import Effects
import Signal

{-| Sends the given value to the given address and turns it into an effect
for a different address.
Signal.sendAsEffect address value action
-}
sendAsEffect : Signal.Address a -> a -> (() -> b) -> Effects.Effects b
sendAsEffect address value action =
Signal.send address value
|> Effects.task
|> Effects.map action
4 changes: 2 additions & 2 deletions source/Html/Extra.elm
Original file line number Diff line number Diff line change
Expand Up @@ -214,7 +214,7 @@ onEnter control address handler =
decoder = if control then controlKey else enterIf
in
onWithOptions
"keydown"
"keyup"
stopOptions
decoder
(\code -> Signal.message address handler)
Expand Down Expand Up @@ -246,7 +246,7 @@ onKeysWithDimensions address mappings =
{-| An event listener that runs on input. -}
onInput : Signal.Address a -> (String -> a) -> Html.Attribute
onInput address handler =
on "input" targetValue (\str -> Signal.message address (handler str))
on "input" targetValue (\str -> Signal.message address (handler str))

{-| A load event listener .-}
onLoad : Signal.Address a -> a -> Html.Attribute
Expand Down
Loading

0 comments on commit b58fc5c

Please sign in to comment.