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 @@ -51,6 +51,20 @@ function writeState(this_) {
5151}
5252exports . writeState = writeState ;
5353
54+ function writeStateWithCallback ( this_ , cb ) {
55+ return function ( state ) {
56+ return function ( cb ) {
57+ return function ( ) {
58+ this_ . setState ( {
59+ state : state
60+ } , cb ) ;
61+ return state ;
62+ } ;
63+ } ;
64+ } ;
65+ }
66+ exports . writeStateWithCallback = writeStateWithCallback ;
67+
5468function readState ( this_ ) {
5569 return function ( ) {
5670 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
@@ -302,6 +303,9 @@ foreign import writeState :: forall props state access eff.
302303 state ->
303304 Eff (state :: ReactState (write :: Write | access ) | eff ) state
304305
306+ -- | Write the component state with a callback.
307+ 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
308+
305309-- | Read the component state.
306310foreign import readState :: forall props state access eff .
307311 ReactThis props state ->
You can’t perform that action at this time.
0 commit comments