redlightscan-cordova-plugin/README.md

54 lines
1.3 KiB
Markdown
Raw Permalink Blame History

This file contains invisible Unicode characters

This file contains invisible Unicode characters that are indistinguishable to humans but may be processed differently by a computer. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# 富立叶红光扫码插件
## 安装方法
`cordova plugin add git+https://m.shuto.cn:8681/center/redlightscan-cordova-plugin.git`
## 调用方法
```javascript
/**
* 开始扫码持续5秒
* @Param 成功callback
* @Param 失败callback
*
*/
redlightscan.startScan(success, error);
```
```javascript
/**
* 停止扫码一般不需要调用开始扫码后5秒如果没有内容会自动停止
* @Param 成功callback
* @Param 失败callback
*
*/
redlightscan.stopScan(success, error);
```
```javascript
/**
* 注册接收器
* @Param 成功callback
* @Param 失败callback
*/
redlightscan.registerReceiver(success, error);
```
```javascript
/**
* 注销接收器
* @Param 成功callback
* @Param 失败callback
*/
redlightscan.unregisterReceiver(success, error);
```
## 说明
1. 在界面上通过按钮或其它点击交互时可调用 redlightscan.startScan(),在 success 回调中可获取读取到的内容。
2. 通过物理按键扫码时可调用 redlightscan.registerReceiver(),在 success 回调中可获取读取到的内容。
3. redlightscan.startScan() 和 redlightscan.registerReceiver() 使用的是同一个 receiver。
[示例 app](http://m.shuto.cn:8680/center/redlightScan.git)