bat-api

1.1.55 • Public • Published

Bat-Driver Api

Installation

$ npm i bat-api

Documentation

Usage

const batDriver = require('bat-api');

const remoteConfig = {
    host: 'localhost',
    port: 8090
}

const main = async () => {    
    // create driver handler
    let driver = new batDriver(remoteConfig);

    // bind linstener
    driver.bind('device.del', sn => {
        console.log(sn);
    });

    // call driver by the protocol
    let res = await driver.call('container.idle', {
        type: 'android'
    });

    // init driver, specify the device info
    driver.initDevice({type: 'android', id: 'PBV0216620000092'});

    // call driver by the adb method
    res = await driver.adb.devices();

    // close driver
    driver.close();
}

main();

API

基础 API

bind

绑定监听事件,监听 Bat-driver 的事件推送

Parameters
Name Type Description
method string 监听事件
callback Function 处理函数

close

关闭 Bat-driver 代理


call → { Promise.< Object > }

向 Bat-driver 发起远程方法调用。

通信协议详情请见:./docs/protocol.md

Parameters
Name Type Description
method string 调用方法
payload Function 携带参数
timeout int 调用超时时间
Returns

Type Promise.< Object >


adb


container

Versions

Current Tags

VersionDownloads (Last 7 Days)Tag
1.1.551latest

Version History

VersionDownloads (Last 7 Days)Published
1.1.551
1.1.530
1.1.520
1.1.510
1.1.500
1.1.360
1.1.330
1.1.320
1.1.310
1.1.300
1.1.80
1.1.60
1.1.30
1.1.20
1.1.10
1.1.00
1.0.620
1.0.610
1.0.600
1.0.520
1.0.510
1.0.500
1.0.330
1.0.320
1.0.301
1.0.270
1.0.260
1.0.250
1.0.220
1.0.211
1.0.200
1.0.180
1.0.176
1.0.160
1.0.151
1.0.130
1.0.120
1.0.110
1.0.100
1.0.90
1.0.61
1.0.50
1.0.30
1.0.10
1.0.00

Package Sidebar

Install

npm i bat-api

Weekly Downloads

11

Version

1.1.55

License

MIT

Unpacked Size

24.9 kB

Total Files

14

Last publish

Collaborators

  • sharenaive
  • liuyuekeng