function launchFileChooser ( ) { const uploader = document . querySelector ( '.hidden-uploader' ) ; if ( uploader ) { uploader . click ( ) ; } } Polymer ( { is : 'paw-filechooser' , properties : { onFileChosen : Object , } , ready ( ) { const uploader = document . querySelector ( '.hidden-uploader' ) ; uploader . addEventListener ( 'change' , ( event ) => { const file = ( event . target as HTMLInputElement ) . files [ 0 ] ; if ( file !== undefined && file . path !== undefined ) { this . onFileChosen ( file . path ) ; } } ) ; } , } ) ;