@@ -58,6 +58,7 @@ import * as Sful from './Samples/StatefulInView';
5858import * as Rest from './Samples/Rest' ;
5959import * as TimeSample from './Samples/TimeSample' ;
6060import * as EventsSample from './Samples/EventsSample' ;
61+ import * as SelectSample from './Samples/SelectSample' ;
6162import * as PortsSample from './Samples/PortsSample' ;
6263import { appSamplePorts } from "./Samples/PortsSample" ;
6364
@@ -166,6 +167,7 @@ interface Samples {
166167 readonly rest : Rest . Model ;
167168 readonly time : TimeSample . Model ;
168169 readonly events : EventsSample . Model ;
170+ readonly select : SelectSample . Model ;
169171 readonly ports : PortsSample . Model ;
170172}
171173
@@ -180,6 +182,7 @@ type Msg =
180182 | { type : 'rest' ; child : Rest . Msg }
181183 | { type : 'timeSample' ; child : TimeSample . Msg }
182184 | { type : 'eventsSample' ; child : EventsSample . Msg }
185+ | { type : 'selectSample' ; child : SelectSample . Msg }
183186 | { type : 'portsSample' ; child : PortsSample . Msg }
184187 | { type : 'urlChange' ; location : Location }
185188 | { type : 'newUrl' ; url : string }
@@ -199,6 +202,7 @@ function initSamples(): [Model, Cmd<Msg>] {
199202 const rest = Rest . init ( ) ;
200203 const time = TimeSample . init ( ) ;
201204 const events = EventsSample . init ( ) ;
205+ const select = SelectSample . init ( ) ;
202206 const ports = PortsSample . init ( ) ;
203207 return [
204208 {
@@ -214,6 +218,7 @@ function initSamples(): [Model, Cmd<Msg>] {
214218 rest : rest [ 0 ] ,
215219 time : time [ 0 ] ,
216220 events : events [ 0 ] ,
221+ select : select [ 0 ] ,
217222 ports : ports [ 0 ] ,
218223 } ,
219224 } ,
@@ -228,6 +233,7 @@ function initSamples(): [Model, Cmd<Msg>] {
228233 rest [ 1 ] . map ( mapRest ) ,
229234 time [ 1 ] . map ( mapTimeSample ) ,
230235 events [ 1 ] . map ( mapEventsSample ) ,
236+ select [ 1 ] . map ( mapSelectSample ) ,
231237 ports [ 1 ] . map ( mapPortsSample ) ,
232238 ] ) ,
233239 ] ;
@@ -350,6 +356,13 @@ function mapEventsSample(m: EventsSample.Msg): Msg {
350356 } ;
351357}
352358
359+ function mapSelectSample ( m : SelectSample . Msg ) : Msg {
360+ return {
361+ type : 'selectSample' ,
362+ child : m ,
363+ } ;
364+ }
365+
353366function mapPortsSample ( m : PortsSample . Msg ) : Msg {
354367 return {
355368 type : 'portsSample' ,
@@ -402,6 +415,7 @@ function viewHome(dispatch: Dispatcher<Msg>) {
402415 </ a >
403416 .
404417 </ p >
418+ < pre > React version: { React . version } </ pre >
405419 </ div >
406420 ) ;
407421}
@@ -576,6 +590,8 @@ function viewSamples(dispatch: Dispatcher<Msg>, samples: Samples) {
576590 { TimeSample . view ( map ( dispatch , mapTimeSample ) , samples . time ) }
577591 < h2 > Events</ h2 >
578592 { EventsSample . view ( map ( dispatch , mapEventsSample ) , samples . events ) }
593+ < h2 > Select</ h2 >
594+ { SelectSample . view ( map ( dispatch , mapSelectSample ) , samples . select ) }
579595 < h2 > Ports</ h2 >
580596 { PortsSample . view ( map ( dispatch , mapPortsSample ) , samples . ports ) }
581597 < button onClick = { ( ) => {
@@ -657,6 +673,12 @@ function update(msg: Msg, model: Model): [Model, Cmd<Msg>] {
657673 return [ { ...s , events : macEvents [ 0 ] } , macEvents [ 1 ] . map ( mapEventsSample ) ] ;
658674 } ) ;
659675
676+ case 'selectSample' :
677+ return mapSample ( ( s : Samples ) => {
678+ const macSelect = SelectSample . update ( msg . child , s . select ) ;
679+ return [ { ...s , select : macSelect [ 0 ] } , macSelect [ 1 ] . map ( mapSelectSample ) ] ;
680+ } ) ;
681+
660682 case 'urlChange' :
661683 return init ( msg . location ) ;
662684
@@ -672,13 +694,14 @@ function update(msg: Msg, model: Model): [Model, Cmd<Msg>] {
672694function subscriptions ( model : Model ) : Sub < Msg > {
673695 switch ( model . tag ) {
674696 case 'samples' :
675- const { counter, parentChild, raf, time, events } = model . samples ;
697+ const { counter, parentChild, raf, time, events, select } = model . samples ;
676698 return Sub . batch ( [
677699 Counter . subscriptions ( counter ) . map ( mapCounter ) ,
678700 ParentChild . subscriptions ( parentChild ) . map ( mapParentChild ) ,
679701 Raf . subscriptions ( raf ) . map ( mapRaf ) ,
680702 TimeSample . subscriptions ( time ) . map ( mapTimeSample ) ,
681703 EventsSample . subscriptions ( events ) . map ( mapEventsSample ) ,
704+ SelectSample . subscriptions ( select ) . map ( mapSelectSample ) ,
682705 PortsSample . subscriptions ( ) . map ( mapPortsSample ) ,
683706 ] ) ;
684707 default :
0 commit comments