node-dbus-next icon indicating copy to clipboard operation
node-dbus-next copied to clipboard

Dynamically disable interface members

Open acrisci opened this issue 7 years ago • 2 comments

Some properties, methods, or signals might be optional. Mpris for instance has optional properties. Optional members should be omitted from introspection xml and ignored when they are gotten/set/called.

Maybe like this:

iface.disableProperty('OptionalProp');

Or maybe like this for more extensibility:

iface.getPropertyInfo('OptionalProp').disabled = true;

acrisci avatar Nov 07 '18 22:11 acrisci

Maybe a few static methods on the Interface to do this.

static updatePropertyOptions(iface, name, options);
static updateSignalOptions(iface, name, options);
static updateMethodOptions(iface, name, options);

acrisci avatar Feb 13 '19 19:02 acrisci

Eh maybe this isn't a good idea because of how introspection normally works. You can use class expressions to dynamically make your classes to accomplish the use case.

acrisci avatar Feb 15 '19 01:02 acrisci