How to use the asyncbox.asyncify function in asyncbox

To help you get started, we’ve selected a few asyncbox 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 appium / node-adb-client / lib / examples / reboot.js View on Github external
if (availableDevices.length > 0) {
    // just select the first device
    let device = new ADB(CONNECTION_TYPES.USB, availableDevices[0]);
    await device.connect();
    console.log("connected");
    let command = {
      type:   "reboot"
    };
    await device.runCommand(command);
    await device.closeConnection();
    console.log("closed");
  }
}

console.log("starting");
asyncify(start);
github appium / appium-remote-debugger / bin / web_inspector_proxy.js View on Github external
});

  await proc.start();

  return prom;
}

async function main () {
  const udid = _.last(process.argv);
  const s = await getSocket(udid);
  console.log('Simulator web inspector socket:', s);
  // await moveSocket(s);
  await startSoCat(s);
}

asyncify(main);
github appium / node-adb-client / fsm.js View on Github external
this.publicKeyAccepted();
      }
    },
    ontimeout: function () {
      console.log("timeout occured, returning to start");
    }
  }
});

async function start() {
  await fsm.start();
  console.log(fsm.current);
  fsm.open();
}

asyncify(start);
github appium / node-adb-client / lib / examples / pull.js View on Github external
, ".."
                                     , ".."
                                     , "largeFile");
    let command = {
      type:        "pull"
    , source:      "sdcard/largeFile"
    , destination: destinationFile
    };
    await device.runCommand(command);
    await device.closeConnection();
    console.log("closed");
  }
}

console.log("Starting!");
asyncify(start);
github appium / appium-mac-driver / index.js View on Github external
import * as driver from './lib/driver';


const { MacDriver } = driver;

const DEFAULT_HOST = 'localhost';
const DEFAULT_PORT = 4723;

async function main () {
  let port = yargs.argv.port || DEFAULT_PORT;
  let address = yargs.argv.address || DEFAULT_HOST;
  return await startServer(port, address);
}

if (require.main === module) {
  asyncify(main);
}

export { MacDriver };

export default MacDriver;
github appium / appium-uiautomator2-driver / index.js View on Github external
const { AndroidUiautomator2Driver } = driver;
const { startServer } = server;

export const DEFAULT_HOST = 'localhost';
export const DEFAULT_PORT = 4884;

async function main () {
  let port = yargs.argv.port || DEFAULT_PORT;
  let host = yargs.argv.host || yargs.argv.address || DEFAULT_HOST;
  return await startServer(port, host);
}

if (require.main === module) {
  asyncify(main);
}

export { AndroidUiautomator2Driver, startServer };
export default AndroidUiautomator2Driver;
github appium / appium / ci-jobs / scripts / set-package-json-version.js View on Github external
const packageJson = require('../../package.json');

const log = new logger.getLogger('Create Release Branch:');

async function setPackageJsonVersion (version = `${process.env.MINOR_BRANCH_NAME}.0-rc.0`) {
  packageJson.version = version;
  log.info(`Setting version to: ${version}`);
  await fs.writeFile(
    path.resolve(__dirname, '..', '..', 'package.json'),
    JSON.stringify(packageJson, null, 2),
    'utf8',
  );
}

if (require.main === module) {
  asyncify(setPackageJsonVersion);
}

module.exports = setPackageJsonVersion;
github appium / appium / check-pruned-shrinkwrap.js View on Github external
const shrinkwrapPath = path.resolve('npm-shrinkwrap.json');
  if (!(await fs.exists(shrinkwrapPath))) {
    log.info('No shrinkwrap found. Skipping shrinkwrap check');
    return;
  }
  const shrinkwrap = JSON.parse(await fs.readFile(shrinkwrapPath));
  const backupShrinkwrap = JSON.parse(await fs.readFile(path.resolve('npm-shrinkwrap-backup.json')));
  log.info('Checking that pruned shrinkwrap is a subset of primary shrinkwrap');
  if (!_.isMatch(backupShrinkwrap, shrinkwrap)) {
    log.errorAndThrow('Pruned shrinkwrap (shrinkwrap with dev dependencies removed) is not a subset of the original npm-shrinkwrap.json');
  }
  log.info('Shrinkwrap check passed');
}

if (require.main === module) {
  asyncify(main);
}
github appium / appium-ios-driver / index.js View on Github external
import yargs from 'yargs';
import { asyncify } from 'asyncbox';
import * as server from './lib/server';

const DEFAULT_HOST = 'localhost';
const DEFAULT_PORT = 4723;

async function main () {
  let port = yargs.argv.port || DEFAULT_PORT;
  let host = yargs.argv.host || DEFAULT_HOST;
  return await server.startServer(port, host);
}

if (require.main === module) {
  asyncify(main);
}


import * as driver from './lib/driver';
import * as caps from './lib/desired-caps';
import * as commandIndex from './lib/commands/index';
import * as settings from './lib/settings';
import * as device from './lib/device';
import * as utils from './lib/utils';
import * as iwdp from './lib/iwdp';
import * as uiauto from './lib/uiauto/uiauto';
import * as instruments from './lib/instruments/index';
import * as context from './lib/commands/context';

const startHttpsServer = server.startHttpsServer;
const { IosDriver, defaultServerCaps } = driver;
github appium / appium-android-driver / index.js View on Github external
import * as server from './lib/server';


const { startServer } = server;

const DEFAULT_HOST = 'localhost';
const DEFAULT_PORT = 4723;

async function main () {
  let port = yargs.argv.port || DEFAULT_PORT;
  let host = yargs.argv.host || DEFAULT_HOST;
  return await startServer(port, host);
}

if (require.main === module) {
  asyncify(main);
}


import * as driver from './lib/driver';
import * as androidHelperIndex from './lib/android-helpers';
import * as commandIndex from './lib/commands/index';
import * as webview from './lib/webview-helpers';
import * as caps from './lib/desired-caps';


const { AndroidDriver } = driver;
const { helpers: webviewHelpers, NATIVE_WIN, WEBVIEW_WIN, WEBVIEW_BASE,
        CHROMIUM_WIN } = webview;
const { commonCapConstraints } = caps;
const { commands: androidCommands } = commandIndex;
const { helpers: androidHelpers, SETTINGS_HELPER_PKG_ID } = androidHelperIndex;

asyncbox

A collection of small async/await utilities

Apache-2.0
Latest version published 1 year ago

Package Health Score

57 / 100
Full package analysis