Skip to content

Commit c32ce45

Browse files
committed
Minor documentation and coding style update
1 parent a8f55c1 commit c32ce45

File tree

3 files changed

+9
-8
lines changed

3 files changed

+9
-8
lines changed

README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -179,6 +179,7 @@ Registry class also provides the normal registry operations:
179179
corresponding JavaScript value types.
180180

181181
- disableLogging()
182+
182183
By default, methods in this package may log warnings and errors to console. If it's not desired, call this
183184
method to turn off logging. Note, it does not turn off the warnings logged in finalizers when opened keys
184185
and monitor tokens are not properly closed/stopped, because they indicate wrong usage of this package.

lib/windows-registry.js

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const ref = require('ref-napi');
43
const ffi = require('ffi-napi');
4+
const ref = require('ref-napi');
55

66
const {
77
error,
@@ -296,23 +296,23 @@ const EventApi = ffi.Library('kernel32', {
296296
});
297297

298298
/** Finalizer for RegistryKey to ensure the underlying registry key handle is closed. */
299-
const RegistryKeyFinalizer = new FinalizationRegistry(registryKeyData => {
299+
const registryKeyFinalizer = new FinalizationRegistry(registryKeyData => {
300300
if (registryKeyData.handle !== null) {
301301
warning(`RegistryKey ${registryKeyData.path} is not properly closed! You should call RegistryKey.close() or Registry.closeKey() to close a key when it is no longer needed!`);
302302
Registry.instance.closeKeyInternal(registryKeyData);
303303
}
304304
});
305305

306306
/** Finalizer for MonitoredRegistryKey to ensure the underlying event handle is closed. */
307-
const MonitoredRegistryKeyFinalizer = new FinalizationRegistry(monitorData => {
307+
const monitoredRegistryKeyFinalizer = new FinalizationRegistry(monitorData => {
308308
if (monitorData.waitHandle !== null) {
309309
warning(`MonitoredRegistryKey ${registryKeyData.path} is not properly stopped! You should call Registry.stopMonitor() to stop monitoring a key when it is no longer needed!`);
310310
Registry.instance.stopMonitoredKeyInternal(monitorData);
311311
}
312312
});
313313

314314
/** Finalizer for MonitorToken to ensure the callback is unregistered. */
315-
const MonitorTokenFinalizer = new FinalizationRegistry(tokenData => {
315+
const monitorTokenFinalizer = new FinalizationRegistry(tokenData => {
316316
if (!tokenData.calback !== null) {
317317
warning(`MonitorToken on key ${tokenData.path} is not properly removed! You should call MonitorToken.stop() or Registry.stopMonitor() to stop monitoring a key when it is no longer needed!`);
318318
Registry.instance.stopMonitorInternal(tokenData);
@@ -356,7 +356,7 @@ class RegistryKey {
356356
this.open();
357357

358358
// Register this key in finalizer so we can be alerted if it's not properly closed
359-
RegistryKeyFinalizer.register(this, this.keyData);
359+
registryKeyFinalizer.register(this, this.keyData);
360360
}
361361

362362
/**
@@ -740,7 +740,7 @@ class MonitoredRegistryKey extends RegistryKey {
740740
this.start();
741741

742742
// Register this key in finalizer so we can be alerted if it's not properly stopped
743-
MonitoredRegistryKeyFinalizer.register(this, this.monitorData);
743+
monitoredRegistryKeyFinalizer.register(this, this.monitorData);
744744
}
745745

746746
/**
@@ -898,7 +898,7 @@ class MonitorToken {
898898
};
899899

900900
// Register this token in finalizer so we can be alerted if it's not properly stopped
901-
MonitorTokenFinalizer.register(this, this.tokenData);
901+
monitorTokenFinalizer.register(this, this.tokenData);
902902
}
903903

904904
/**

lib/windows-system-error-text.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
'use strict';
22

3-
const ref = require('ref-napi');
43
const ffi = require('ffi-napi');
4+
const ref = require('ref-napi');
55

66
const { fromNullTerminatedWString } = require('./wstring.js');
77

0 commit comments

Comments
 (0)