@@ -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' ,
@@ -576,6 +589,8 @@ function viewSamples(dispatch: Dispatcher<Msg>, samples: Samples) {
576589 { TimeSample . view ( map ( dispatch , mapTimeSample ) , samples . time ) }
577590 < h2 > Events</ h2 >
578591 { EventsSample . view ( map ( dispatch , mapEventsSample ) , samples . events ) }
592+ < h2 > Select</ h2 >
593+ { SelectSample . view ( map ( dispatch , mapSelectSample ) , samples . select ) }
579594 < h2 > Ports</ h2 >
580595 { PortsSample . view ( map ( dispatch , mapPortsSample ) , samples . ports ) }
581596 < button onClick = { ( ) => {
@@ -657,6 +672,12 @@ function update(msg: Msg, model: Model): [Model, Cmd<Msg>] {
657672 return [ { ...s , events : macEvents [ 0 ] } , macEvents [ 1 ] . map ( mapEventsSample ) ] ;
658673 } ) ;
659674
675+ case 'selectSample' :
676+ return mapSample ( ( s : Samples ) => {
677+ const macSelect = SelectSample . update ( msg . child , s . select ) ;
678+ return [ { ...s , select : macSelect [ 0 ] } , macSelect [ 1 ] . map ( mapSelectSample ) ] ;
679+ } ) ;
680+
660681 case 'urlChange' :
661682 return init ( msg . location ) ;
662683
@@ -672,13 +693,14 @@ function update(msg: Msg, model: Model): [Model, Cmd<Msg>] {
672693function subscriptions ( model : Model ) : Sub < Msg > {
673694 switch ( model . tag ) {
674695 case 'samples' :
675- const { counter, parentChild, raf, time, events } = model . samples ;
696+ const { counter, parentChild, raf, time, events, select } = model . samples ;
676697 return Sub . batch ( [
677698 Counter . subscriptions ( counter ) . map ( mapCounter ) ,
678699 ParentChild . subscriptions ( parentChild ) . map ( mapParentChild ) ,
679700 Raf . subscriptions ( raf ) . map ( mapRaf ) ,
680701 TimeSample . subscriptions ( time ) . map ( mapTimeSample ) ,
681702 EventsSample . subscriptions ( events ) . map ( mapEventsSample ) ,
703+ SelectSample . subscriptions ( select ) . map ( mapSelectSample ) ,
682704 PortsSample . subscriptions ( ) . map ( mapPortsSample ) ,
683705 ] ) ;
684706 default :
0 commit comments