dbusjs / node-dbus-next

🚌 The next great dbus library for node
https://www.npmjs.com/package/dbus-next
155 stars 52 forks source link

Dynamically disable interface members #2

Open acrisci opened 5 years ago

acrisci commented 5 years ago

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 commented 5 years ago

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 commented 5 years ago

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.