How to use the dbus-next.validators function in dbus-next

To help you get started, we’ve selected a few dbus-next examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github dbusjs / mpris-service / src / index.js View on Github external
Player.prototype.init = function(opts) {
  this.serviceName = `org.mpris.MediaPlayer2.${this.name}`;
  dbus.validators.assertBusNameValid(this.serviceName);

  this._bus = dbus.sessionBus();

  this._bus.on('error', (err) => {
    this.emit('error', err);
  });

  this.interfaces = {};

  this._addRootInterface(this._bus, opts);

  if (this.supportedInterfaces.indexOf('player') >= 0) {
    this._addPlayerInterface(this._bus);
  }
  if (this.supportedInterfaces.indexOf('trackList') >= 0) {
    this._addTracklistInterface(this._bus);