Skip to content

Commit

Permalink
Updates for 0.11 (#4)
Browse files Browse the repository at this point in the history
* Updates for 0.11

* Use latest dom
  • Loading branch information
paf31 authored Apr 5, 2017
1 parent 0c2c829 commit 5854e91
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 33 deletions.
15 changes: 15 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
language: node_js
dist: trusty
sudo: required
node_js: stable
install:
- npm install -g bower
- npm install
- bower install
script:
- npm run -s build
after_success:
- >-
test $TRAVIS_TAG &&
echo $GITHUB_TOKEN | pulp login &&
echo y | pulp publish --no-push
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

Low-level React DOM bindings for PureScript

- [Module Documentation](docs/)
- [Module Documentation](generated-docs/)

## Installation

Expand Down
6 changes: 3 additions & 3 deletions bower.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"url": "git://github.com/purescript-contrib/purescript-react-dom.git"
},
"dependencies": {
"purescript-dom": "^3.1.0",
"purescript-react": "^2.0.0",
"purescript-eff-functions": "^2.0.0"
"purescript-dom": "^4.0.0",
"purescript-react": "^3.0.0",
"purescript-eff": "^3.1.0"
}
}
File renamed without changes.
14 changes: 10 additions & 4 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
{
"name": "purescript-react-dom",
"files": [],
"peerDependencies": {
"react-dom": "^0.14.6"
"private": true,
"scripts": {
"clean": "rimraf output && rimraf .pulp-cache",
"build": "pulp build"
},
"devDependencies": {
"pulp": "^11.0.0",
"purescript-psa": "^0.5.0",
"purescript": "^0.11.1",
"rimraf": "^2.5.4"
}
}
56 changes: 31 additions & 25 deletions src/ReactDOM.purs
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,19 @@ module ReactDOM
) where

import Control.Monad.Eff (Eff)
import DOM (DOM)
import DOM.Node.Types (Element)
import Data.Function.Eff (runEffFn1, EffFn4, EffFn1, runEffFn4)
import Control.Monad.Eff.Uncurried (runEffFn1, EffFn4, EffFn1, runEffFn4)
import Data.Function.Uncurried (runFn1, Fn1)
import Data.Maybe (Maybe(..))
import DOM (DOM)
import DOM.Node.Types (Element)
import React (ReactElement, ReactComponent)

-- | Render a React element in a document element. Returns Nothing for stateless components.
render :: forall eff.
ReactElement -> Element -> Eff (dom :: DOM | eff) (Maybe ReactComponent)
render
:: forall eff
. ReactElement
-> Element
-> Eff (dom :: DOM | eff) (Maybe ReactComponent)
render = runEffFn4 renderImpl Nothing Just

-- | Removes a mounted React element in a document element.
Expand All @@ -36,26 +39,29 @@ renderToString = runFn1 renderToStringImpl
renderToStaticMarkup :: ReactElement -> String
renderToStaticMarkup = runFn1 renderToStaticMarkupImpl

foreign import renderImpl :: forall eff.
EffFn4
(dom :: DOM | eff)
(Maybe ReactComponent)
(ReactComponent -> Maybe ReactComponent)
ReactElement
Element
(Maybe ReactComponent)

foreign import unmountComponentAtNodeImpl :: forall eff.
EffFn1
(dom :: DOM | eff)
Element
Boolean

foreign import findDOMNodeImpl :: forall eff.
EffFn1
(dom :: DOM | eff)
ReactComponent
Element
foreign import renderImpl
:: forall eff
. EffFn4
(dom :: DOM | eff)
(Maybe ReactComponent)
(ReactComponent -> Maybe ReactComponent)
ReactElement
Element
(Maybe ReactComponent)

foreign import unmountComponentAtNodeImpl
:: forall eff
. EffFn1
(dom :: DOM | eff)
Element
Boolean

foreign import findDOMNodeImpl
:: forall eff
. EffFn1
(dom :: DOM | eff)
ReactComponent
Element

foreign import renderToStringImpl :: Fn1 ReactElement String

Expand Down

0 comments on commit 5854e91

Please sign in to comment.