33var React = require ( "react" ) ;
44var Fragment = React . Fragment || "div" ;
55
6- exports . readProps = function ( self ) {
7- return self . instance_ . props . $$props ;
8- } ;
9-
10- exports . readState = function ( self ) {
11- var state = self . instance_ . state ;
12- return state === null ? null : state . $$state ;
13- } ;
14-
15- exports . send_ = function ( buildStateUpdate ) {
16- return function ( self , action ) {
17- if ( ! self . instance_ . $$mounted ) {
18- exports . warningUnmountedComponentAction ( self , action ) ;
19- return ;
20- }
21- var sideEffects = null ;
22- self . instance_ . setState (
23- function ( s ) {
24- var setStateContext = self . instance_ . toSelf ( ) ;
25- setStateContext . state = s . $$state ;
26- var updates = buildStateUpdate (
27- self . instance_ . $$spec . update ( setStateContext ) ( action )
28- ) ;
29- if ( updates . effects !== null ) {
30- sideEffects = updates . effects ;
31- }
32- if ( updates . state !== null && updates . state !== s . $$state ) {
33- return { $$state : updates . state } ;
34- } else {
35- return null ;
36- }
37- } ,
38- function ( ) {
39- if ( sideEffects !== null ) {
40- sideEffects ( this . toSelf ( ) ) ( ) ;
41- }
42- }
43- ) ;
44- } ;
45- } ;
46-
476exports . createComponent_ = function ( defaultUpdate ) {
487 var defaultInitialState = null ;
498 var defaultShouldUpdate = function ( ) {
@@ -150,6 +109,47 @@ exports.createComponent_ = function(defaultUpdate) {
150109 } ;
151110} ;
152111
112+ exports . send_ = function ( buildStateUpdate ) {
113+ return function ( self , action ) {
114+ if ( ! self . instance_ . $$mounted ) {
115+ exports . warningUnmountedComponentAction ( self , action ) ;
116+ return ;
117+ }
118+ var sideEffects = null ;
119+ self . instance_ . setState (
120+ function ( s ) {
121+ var setStateContext = self . instance_ . toSelf ( ) ;
122+ setStateContext . state = s . $$state ;
123+ var updates = buildStateUpdate (
124+ self . instance_ . $$spec . update ( setStateContext ) ( action )
125+ ) ;
126+ if ( updates . effects !== null ) {
127+ sideEffects = updates . effects ;
128+ }
129+ if ( updates . state !== null && updates . state !== s . $$state ) {
130+ return { $$state : updates . state } ;
131+ } else {
132+ return null ;
133+ }
134+ } ,
135+ function ( ) {
136+ if ( sideEffects !== null ) {
137+ sideEffects ( this . toSelf ( ) ) ( ) ;
138+ }
139+ }
140+ ) ;
141+ } ;
142+ } ;
143+
144+ exports . readProps = function ( self ) {
145+ return self . instance_ . props . $$props ;
146+ } ;
147+
148+ exports . readState = function ( self ) {
149+ var state = self . instance_ . state ;
150+ return state === null ? null : state . $$state ;
151+ } ;
152+
153153exports . make = function ( $$spec ) {
154154 return function ( $$props ) {
155155 var props = {
@@ -160,6 +160,8 @@ exports.make = function($$spec) {
160160 } ;
161161} ;
162162
163+ exports . empty = null ;
164+
163165exports . keyed_ = function ( key , child ) {
164166 return React . createElement ( Fragment , { key : key } , child ) ;
165167} ;
@@ -177,13 +179,6 @@ exports.fragment = function(children) {
177179 return React . createElement . apply ( null , [ Fragment , { } ] . concat ( children ) ) ;
178180} ;
179181
180- exports . fragmentKeyed_ = function ( key , children ) {
181- return React . createElement . apply (
182- null ,
183- [ Fragment , { key : key } ] . concat ( children )
184- ) ;
185- } ;
186-
187182exports . displayNameFromComponentSpec = function ( $$spec ) {
188183 return $$spec . $$type . displayName || "[unknown]" ;
189184} ;
0 commit comments