22
33var browserClient = new Dropbox . Client ( { key : "your-key-here" } ) ;
44
5- browserClient . authenticate ( function ( error , client ) {
5+ browserClient . authenticate ( ( error : any , client : Dropbox . Client ) => {
66 if ( error ) {
77 alert ( error ) ;
88 }
99
10- client . onError . addListener ( function ( error ) {
11- if ( window . console ) { // Skip the "if" in node.js code.
10+ client . onError . addListener ( ( error : any ) => {
11+ if ( window [ ' console' ] ) { // Skip the "if" in node.js code.
1212 console . error ( error ) ;
1313 }
1414 } ) ;
1515
16- client . getAccountInfo ( function ( error , accountInfo ) {
16+ client . getAccountInfo ( ( error : Dropbox . ApiError , accountInfo : Dropbox . AccountInfo ) => {
1717 if ( error ) {
1818 alert ( error ) ; // Something went wrong.
1919 }
2020
2121 alert ( "Hello, " + accountInfo . name + "!" ) ;
2222 } ) ;
2323
24- client . writeFile ( "hello_world.txt" , "Hello, world!\n" , function ( error , stat ) {
24+ client . writeFile ( "hello_world.txt" , "Hello, world!\n" , ( error : Dropbox . ApiError , stat : Dropbox . File . Stat ) => {
2525 if ( error ) {
2626 alert ( error ) ; // Something went wrong.
2727 }
2828
2929 alert ( "File saved as revision " + stat . versionTag ) ;
3030 } ) ;
3131
32- client . readFile ( "hello_world.txt" , function ( error , data ) {
32+ client . readFile ( "hello_world.txt" , ( error : Dropbox . ApiError , data : string ) => {
3333 if ( error ) {
3434 alert ( error ) ; // Something went wrong.
3535 }
3636
3737 alert ( data ) ; // data has the file's contents
3838 } ) ;
3939
40- client . readdir ( "/" , function ( error , entries ) {
40+ client . readdir ( "/" , ( err : Dropbox . ApiError , filenames : string [ ] , stat : Dropbox . File . Stat , folderEntries ?: Dropbox . File . Stat [ ] ) => {
4141 if ( error ) {
4242 alert ( error ) ; // Something went wrong.
4343 }
4444
45- alert ( "Your Dropbox contains " + entries . join ( ", " ) ) ;
45+ alert ( "Your Dropbox contains " + filenames . join ( ", " ) ) ;
4646 } ) ;
4747} ) ;
4848
49- var serverClient = new Dropbox . Client ( {
49+ var serverClient : Dropbox . Client = new Dropbox . Client ( {
5050 key : "your-key-here" ,
5151 secret : "your-secret-here"
5252} ) ;
5353
54- serverClient . authDriver ( new Dropbox . AuthDriver . NodeServer ( 8191 ) ) ;
54+ serverClient . authDriver ( new Dropbox . AuthDriver . NodeServer ( { port : 8191 } ) ) ;
0 commit comments