File tree Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Expand file tree Collapse file tree 2 files changed +18
-0
lines changed Original file line number Diff line number Diff line change @@ -53,6 +53,20 @@ function writeState(this_) {
5353}
5454exports . writeState = writeState ;
5555
56+ function writeStateWithCallback ( this_ , cb ) {
57+ return function ( state ) {
58+ return function ( cb ) {
59+ return function ( ) {
60+ this_ . setState ( {
61+ state : state
62+ } , cb ) ;
63+ return state ;
64+ } ;
65+ } ;
66+ } ;
67+ }
68+ exports . writeStateWithCallback = writeStateWithCallback ;
69+
5670function readState ( this_ ) {
5771 return function ( ) {
5872 return this_ . state . state ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ module React
4747
4848 , readState
4949 , writeState
50+ , writeStateWithCallback
5051 , transformState
5152
5253 , handle
@@ -281,6 +282,9 @@ foreign import getChildren :: forall props state eff. ReactThis props state -> E
281282-- | Write the component state.
282283foreign import writeState :: forall props state access eff . ReactThis props state -> state -> Eff (state :: ReactState (write :: Write | access ) | eff ) state
283284
285+ -- | Write the component state with a callback.
286+ foreign import writeStateWithCallback :: forall props state access eff . ReactThis props state -> state -> Eff (state :: ReactState (write :: Write | access ) | eff ) Unit -> Eff (state :: ReactState (write :: Write | access ) | eff ) state
287+
284288-- | Read the component state.
285289foreign import readState :: forall props state access eff . ReactThis props state -> Eff (state :: ReactState (read :: Read | access ) | eff ) state
286290
You can’t perform that action at this time.
0 commit comments