@@ -9,32 +9,29 @@ const OPTIONS_FILE_PATH = '/zork-options';
99
1010// Returns Promise<boolean>
1111function checkIfMetricsEnabled ( ) {
12- return OS . File . read ( OPTIONS_FILE_PATH ) . then (
13- function onSuccess ( array ) {
14- try {
15- let decoder = new TextDecoder ( ) ;
16- let text = decoder . decode ( array ) ;
17- let options = JSON . parse ( text ) ;
18- return options [ 'isMetricsEnabled' ] === true ;
19- } catch ( e ) {
20- console . error ( 'Could not parse options file' ) ;
21- return false ;
22- }
12+ return OS . File . read ( OPTIONS_FILE_PATH ) . then ( ( array ) => {
13+ try {
14+ let decoder = new TextDecoder ( ) ;
15+ let text = decoder . decode ( array ) ;
16+ let options = JSON . parse ( text ) ;
17+ return options [ 'isMetricsEnabled' ] === true ;
18+ } catch ( e ) {
19+ console . error ( 'Could not parse options file' ) ;
20+ return false ;
2321 }
24- ) . catch ( function ( e ) {
22+ } ) . catch ( ( e ) => {
2523 console . warn ( 'Could not find options file' ) ;
2624 return false ; // Options file not found, not an error.
2725 } ) ;
2826}
2927
3028var manifest = self . data . url ( "lib/zork/freedom-module.json" ) ;
3129var loggingProviderManifest = self . data . url ( "lib/loggingprovider/freedom-module.json" ) ;
32- var provider ;
3330freedom ( manifest , {
3431 'logger' : loggingProviderManifest ,
3532 'debug' : 'debug'
3633} ) . then ( function ( moduleFactory ) {
37- let provider = moduleFactory ( ) ;
34+ const provider = moduleFactory ( ) ;
3835 checkIfMetricsEnabled ( ) . then ( function ( isEnabled ) {
3936 provider . emit ( 'setMetricsEnablement' , isEnabled ) ;
4037 } ) ;
0 commit comments