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_) {
51
51
}
52
52
exports . writeState = writeState ;
53
53
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
+
54
68
function readState ( this_ ) {
55
69
return function ( ) {
56
70
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
@@ -302,6 +303,9 @@ foreign import writeState :: forall props state access eff.
302
303
state ->
303
304
Eff (state :: ReactState (write :: Write | access ) | eff ) state
304
305
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
+
305
309
-- | Read the component state.
306
310
foreign import readState :: forall props state access eff .
307
311
ReactThis props state ->
You can’t perform that action at this time.
0 commit comments