Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

promisified-dbus-native

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

promisified-dbus-native - npm Package Compare versions

Comparing version 0.0.2 to 0.0.3

example.js

2

package.json
{
"name": "promisified-dbus-native",
"version": "0.0.2",
"version": "0.0.3",
"description": "promisified dbus-native",

@@ -5,0 +5,0 @@ "main": "index.js",

@@ -0,15 +1,49 @@

const assert = require('assert');
const dbus = require('./');
const originalDbus = require('dbus-native');
(async function() {
function introspect0() {
return new Promise((resolve, reject) => {
originalDbus.systemBus().getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable', (err, iface) => {
err ? reject(err) : iface.Introspect((err, result) => {
err ? reject(err) : resolve(result);
})
});
});
}
function introspect1() {
return dbus.systemBus()
.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable')
.then(iface => iface.Introspect())
}
async function introspect2() {
const bus = dbus.systemBus();
const service = await bus.getService('org.freedesktop.DBus');
let obj = await service.getObject('/org/freedesktop/DBus');
let iface = await obj.as('org.freedesktop.DBus.Introspectable');
let result = await iface.Introspect();
console.log(result);
const service = bus.getService('org.freedesktop.DBus');
const obj = await service.getObject('/org/freedesktop/DBus');
const iface = obj.as('org.freedesktop.DBus.Introspectable');
const result = await iface.Introspect();
return result;
}
obj = await bus.getObject('org.freedesktop.DBus', '/org/freedesktop/DBus');
iface = await bus.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable');
result = await iface.Introspect();
console.log(result);
})();
async function introspect3() {
const bus = dbus.systemBus();
const obj = await bus.getObject('org.freedesktop.DBus', '/org/freedesktop/DBus');
const iface = await bus.getInterface('org.freedesktop.DBus', '/org/freedesktop/DBus', 'org.freedesktop.DBus.Introspectable');
const result = await iface.Introspect();
return result;
}
async function run() {
const expected = await introspect0();
let [actual1] = await introspect1();
assert.strictEqual(expected, actual1);
let [actual2] = await introspect2();
assert.strictEqual(expected, actual2);
let [actual3] = await introspect3();
assert.strictEqual(expected, actual3);
console.log('ok');
}
run();
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc