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_) {
53
53
}
54
54
exports . writeState = writeState ;
55
55
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
+
56
70
function readState ( this_ ) {
57
71
return function ( ) {
58
72
return this_ . state . state ;
Original file line number Diff line number Diff line change @@ -47,6 +47,7 @@ module React
47
47
48
48
, readState
49
49
, writeState
50
+ , writeStateWithCallback
50
51
, transformState
51
52
52
53
, handle
@@ -281,6 +282,9 @@ foreign import getChildren :: forall props state eff. ReactThis props state -> E
281
282
-- | Write the component state.
282
283
foreign import writeState :: forall props state access eff . ReactThis props state -> state -> Eff (state :: ReactState (write :: Write | access ) | eff ) state
283
284
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
+
284
288
-- | Read the component state.
285
289
foreign import readState :: forall props state access eff . ReactThis props state -> Eff (state :: ReactState (read :: Read | access ) | eff ) state
286
290
You can’t perform that action at this time.
0 commit comments