You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Property getters seem to be executed as soon as you call configureMembers. This can result in errors as instance state is not initialized yet.
Running the below script with node results in a TypeError, since the private property is initialized in the constructor.
constdbus=require('dbus-next')const{ Interface }=dbus.interfaceclassTestInterfaceextendsInterface{constructor(){this._myPrivateProperty='HELLO'}getmyProperty(){console.log('--> get myProperty')returnthis._myPrivateProperty.toLowerCase()}}TestInterface.configureMembers({properties: {myProperty: {signature: 's'}}})
Terminal output:
--> get myProperty
/private/tmp/test-dbus/index.js:12
return this._myPrivateProperty.toLowerCase()
^
TypeError: Cannot read property 'toLowerCase' of undefined
at Interface.get myProperty [as myProperty] (/private/tmp/test-dbus/index.js:12:37)
at applyDecorator (/private/tmp/test-dbus/node_modules/dbus-next/lib/service/interface.js:314:32)
at Function.configureMembers (/private/tmp/test-dbus/node_modules/dbus-next/lib/service/interface.js:323:7)
at Object.<anonymous> (/private/tmp/test-dbus/index.js:16:15)
at Module._compile (internal/modules/cjs/loader.js:1200:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
at Module.load (internal/modules/cjs/loader.js:1049:32)
at Function.Module._load (internal/modules/cjs/loader.js:937:14)
at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12)
at internal/main/run_main_module.js:17:47
Hi,
Property getters seem to be executed as soon as you call
configureMembers
. This can result in errors as instance state is not initialized yet.Running the below script with node results in a
TypeError
, since the private property is initialized in the constructor.Terminal output:
The issue seems to originate here:
node-dbus-next/lib/service/interface.js
Line 314 in 9c744d5
The text was updated successfully, but these errors were encountered: