@@ -123,7 +123,7 @@ const isCI = !!process.env.CI;
123123let tsAmbient : Record < string , string > ;
124124
125125// TypeScript's scripts are only recompiled if their source hash changes.
126- // If an adapter update fixes the compilation bugs, a user won't notice until the changes and re-saves the script.
126+ // If an adapter update fixes the compilation bugs, a user won't notice until the changes and re-save the script.
127127// To avoid that, we also include the
128128// adapter version and TypeScript version in the hash
129129const tsSourceHashBase = `versions:adapter=${ packageJson . version } ,typescript=${ packageJson . dependencies . typescript } ` ;
@@ -247,7 +247,7 @@ function formatHoursMinutesSeconds(date: Date): string {
247247 return `${ h . padStart ( 2 , '0' ) } :${ m . padStart ( 2 , '0' ) } :${ s . padStart ( 2 , '0' ) } ` ;
248248}
249249
250- // Due to a npm bug, virtual-tsc may be hoisted to the top level node_modules but
250+ // Due to a npm bug, virtual-tsc may be hoisted to the top level node_modules, but
251251// TypeScript may still be in the adapter level (https://npm.community/t/packages-with-peerdependencies-are-incorrectly-hoisted/4794),
252252// so we need to tell virtual-tsc where TypeScript is
253253setTypeScriptResolveOptions ( {
@@ -363,7 +363,7 @@ class JavaScript extends Adapter {
363363 name : 'javascript' , // adapter name
364364 useFormatDate : true ,
365365 /**
366- * If the JS-Controller catches an unhandled error, this will be called
366+ * If the JS-Controller catches an unhandled error, this will be called,
367367 * so we have a chance to handle it ourselves.
368368 */
369369 error : ( err : Error ) : boolean => {
@@ -550,7 +550,7 @@ class JavaScript extends Adapter {
550550 this . timeSettings . leadingZeros = obj . native . leadingZeros === undefined ? true : obj . native . leadingZeros ;
551551 }
552552
553- // send changes to disk mirror
553+ // send changes to the disk mirror
554554 this . mirror ?. onObjectChange ( id , obj as ioBroker . ScriptObject | null ) ;
555555
556556 const formerObj = this . objects [ id ] ;
@@ -621,7 +621,7 @@ class JavaScript extends Adapter {
621621 await this . createActiveObject ( id , ! ! obj . common . enabled ) ;
622622 await this . createProblemObject ( id ) ;
623623 if ( obj . common . enabled ) {
624- // if enabled => Start script
624+ // if enabled => Start a script
625625 await this . loadScriptById ( id ) ;
626626 }
627627 }
@@ -712,7 +712,7 @@ class JavaScript extends Adapter {
712712 } ) ;
713713 }
714714
715- // monitor if adapter is alive and send all subscriptions once more, after adapter goes online
715+ // monitor if the adapter is alive and send all subscriptions once more, after the adapter goes online
716716 if ( /*oldState && */ oldState . val === false && state . val && id . endsWith ( '.alive' ) ) {
717717 if ( this . adapterSubs [ id ] ) {
718718 const parts = id . split ( '.' ) ;
@@ -854,7 +854,7 @@ class JavaScript extends Adapter {
854854 obj . message . instance === this . namespace )
855855 ) {
856856 Object . keys ( this . messageBusHandlers ) . forEach ( name => {
857- // script name could be script.js.xxx or only xxx
857+ // the script name could be script.js.xxx or only xxx
858858 if (
859859 ( ! obj . message . script || obj . message . script === name ) &&
860860 this . messageBusHandlers [ name ] [ obj . message . message ]
@@ -1219,9 +1219,7 @@ class JavaScript extends Adapter {
12191219 method : 'POST' ,
12201220 headers : chatHeaders ,
12211221 timeout : 600000 ,
1222- ...( isHttps && this . config . allowSelfSignedCerts
1223- ? { rejectUnauthorized : false }
1224- : { } ) ,
1222+ ...( isHttps && this . config . allowSelfSignedCerts ? { rejectUnauthorized : false } : { } ) ,
12251223 } ,
12261224 res => {
12271225 let data = '' ;
@@ -1350,9 +1348,7 @@ class JavaScript extends Adapter {
13501348 method : 'GET' ,
13511349 headers : testHeaders ,
13521350 timeout : 10000 ,
1353- ...( isHttps && this . config . allowSelfSignedCerts
1354- ? { rejectUnauthorized : false }
1355- : { } ) ,
1351+ ...( isHttps && this . config . allowSelfSignedCerts ? { rejectUnauthorized : false } : { } ) ,
13561352 } ,
13571353 res => {
13581354 let data = '' ;
@@ -1599,7 +1595,7 @@ class JavaScript extends Adapter {
15991595 await this . sunTimeSchedules ( ) ;
16001596 await this . timeSchedule ( ) ;
16011597
1602- // Store allowSelfSignedCerts on the context so sandbox HTTP functions can use it
1598+ // Store allowSelfSignedCerts on the context, so sandbox HTTP functions can use it
16031599 // without setting the global process.env.NODE_TLS_REJECT_UNAUTHORIZED (which affects all adapters in compact mode)
16041600 this . context . allowSelfSignedCerts = this . config . allowSelfSignedCerts ;
16051601
@@ -1764,7 +1760,7 @@ class JavaScript extends Adapter {
17641760 }
17651761 }
17661762
1767- // CHeck setState counter per minute and stop script if too high
1763+ // CHeck setState counter per minute and stop a script if too high
17681764 this . setStateCountCheckInterval = setInterval ( ( ) => {
17691765 Object . keys ( this . scripts ) . forEach ( id => {
17701766 if ( ! this . scripts [ id ] ) {
@@ -1909,7 +1905,7 @@ class JavaScript extends Adapter {
19091905 }
19101906
19111907 if ( ! obj && this . objects [ id ] ) {
1912- // objects was deleted
1908+ // objects were deleted
19131909 this . removeFromNames ( id ) ;
19141910 delete this . objects [ id ] ;
19151911 } else if ( obj && ! this . objects [ id ] ) {
@@ -2081,7 +2077,7 @@ class JavaScript extends Adapter {
20812077 continue ;
20822078 }
20832079 if ( this . objects [ res . rows [ i ] . doc . _id ] === undefined ) {
2084- // If was already there ignore
2080+ // If was already there, ignore
20852081 this . objects [ res . rows [ i ] . doc . _id ] = res . rows [ i ] . doc ;
20862082 }
20872083 this . objects [ res . rows [ i ] . doc . _id ] . type === 'enum' && this . _enums . push ( res . rows [ i ] . doc . _id ) ;
@@ -2362,7 +2358,7 @@ class JavaScript extends Adapter {
23622358 depName = parts . join ( '@' ) ;
23632359 }
23642360
2365- /** The real module name, because the dependency can be an url too */
2361+ /** The real module name, because the dependency can be a URL too */
23662362 let moduleName = depName ;
23672363
23682364 if ( URL . canParse ( depName ) ) {
@@ -3223,10 +3219,10 @@ class JavaScript extends Adapter {
32233219 * Add declarations for global scripts
32243220 *
32253221 * @param scriptID - The current script the declarations were generated from
3226- * @param declarations - Declarations from script
3222+ * @param declarations - Declarations from a script
32273223 */
32283224 provideDeclarationsForGlobalScript ( scriptID : string , declarations : string ) : void {
3229- // Remember which declarations this global script had access to,
3225+ // Remember which declarations this global script had access to;
32303226 // we need this so the editor doesn't show a duplicate identifier error
32313227 if ( this . globalDeclarations != null && this . globalDeclarations !== '' ) {
32323228 this . knownGlobalDeclarationsByScript [ scriptID ] = this . globalDeclarations ;
@@ -3475,7 +3471,7 @@ function patternMatching(
34753471 return matched ;
34763472}
34773473
3478- // If started as allInOne mode => return function to create instance
3474+ // If started as allInOne mode => return function to create an instance
34793475if ( require . main !== module ) {
34803476 // Export the constructor in compact mode
34813477 module . exports = ( options : Partial < AdapterOptions > | undefined ) => new JavaScript ( options ) ;
0 commit comments