eco-access-specifications 2.0.3 → 2.0.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md ADDED
@@ -0,0 +1,3 @@
1
+ # eco-access-specificationsit
2
+
3
+ eco-access-specifications包源码内容
package/index.js CHANGED
@@ -1,5 +1,2 @@
1
- import { initSpecifications, bleSpecQueue } from "./global.js";
2
- import EcoService from "./main/EcoService.js";
3
- import { addLog, LogPage } from "./main/log.js";
4
- import { oneTrackReport, allTrackPoints } from './eco-track-report/index.js';
5
- export { LogPage, addLog, bleSpecQueue, initSpecifications, EcoService, oneTrackReport, allTrackPoints };
1
+ // index.js
2
+ module.exports = require('./lib/index');
@@ -6,7 +6,7 @@ import { Device } from '../global.js';
6
6
  import { addLog } from "../main/log.js";
7
7
  var createCommandQueue = function createCommandQueue(specMethod) {
8
8
  var commandArray = [];
9
- var callback = null;
9
+ var globalCallback = null; // 全局监听
10
10
  var isProcessing = false;
11
11
  var _checkAndExecute = /*#__PURE__*/function () {
12
12
  var _ref = _asyncToGenerator(/*#__PURE__*/_regeneratorRuntime().mark(function _callee() {
@@ -28,20 +28,34 @@ var createCommandQueue = function createCommandQueue(specMethod) {
28
28
  case 7:
29
29
  result = _context.sent;
30
30
  addLog("spec\u6307\u4EE4\u54CD\u5E94\u6210\u529F\u2705:".concat(JSON.stringify(result)));
31
- callback({
32
- type: command.specWay,
33
- result: result
34
- });
31
+ if (typeof command.onResult === 'function') {
32
+ command.onResult({
33
+ type: command.specWay,
34
+ result: result
35
+ });
36
+ } else if (globalCallback) {
37
+ globalCallback({
38
+ type: command.specWay,
39
+ result: result
40
+ });
41
+ }
35
42
  _context.next = 16;
36
43
  break;
37
44
  case 12:
38
45
  _context.prev = 12;
39
46
  _context.t0 = _context["catch"](4);
40
47
  addLog("spec\u274C\u5931\u8D25:".concat(JSON.stringify(_context.t0)));
41
- callback({
42
- type: command.specWay,
43
- error: _context.t0
44
- });
48
+ if (typeof command.onResult === 'function') {
49
+ command.onResult({
50
+ type: command.specWay,
51
+ error: _context.t0
52
+ });
53
+ } else if (globalCallback) {
54
+ globalCallback({
55
+ type: command.specWay,
56
+ error: _context.t0
57
+ });
58
+ }
45
59
  case 16:
46
60
  isProcessing = false;
47
61
  _checkAndExecute();
@@ -68,7 +82,7 @@ var createCommandQueue = function createCommandQueue(specMethod) {
68
82
  commandArray = [];
69
83
  };
70
84
  var listeners = function listeners(cb) {
71
- callback = cb;
85
+ globalCallback = cb;
72
86
  };
73
87
  return {
74
88
  add: add,
package/lib/index.js ADDED
@@ -0,0 +1,5 @@
1
+ import { initSpecifications, bleSpecQueue } from "./global.js";
2
+ import EcoService from "./main/EcoService.js";
3
+ import { addLog, LogPage } from "./main/log.js";
4
+ import { oneTrackReport, allTrackPoints } from './eco-track-report/index.js';
5
+ export { LogPage, addLog, bleSpecQueue, initSpecifications, EcoService, oneTrackReport, allTrackPoints };
@@ -0,0 +1 @@
1
+ import{bleSpec}from"./main/specMethod";var appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";import{bleSpec}from"./main/specMethod";appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints,appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
@@ -5,10 +5,8 @@ var addLog = function addLog(string) {
5
5
  var data = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : undefined;
6
6
  if (data) {
7
7
  LogUtil.setLogInfo("log->".concat(string).concat(JSON.stringify(data)));
8
- console.log(`log->${ string }${JSON.stringify(data)}`);
9
8
  } else {
10
9
  LogUtil.setLogInfo("log->".concat(string));
11
- console.log(`log->${ string }`);
12
10
  }
13
11
  if (appName === 'miwear-rn-plugin') {
14
12
  localLog(Device.model, "[ECO-rn]->".concat(string));
package/package.json CHANGED
@@ -1,11 +1,29 @@
1
1
  {
2
2
  "name": "eco-access-specifications",
3
- "version": "2.0.3",
3
+ "version": "2.0.4",
4
4
  "description": "生态链公司插件接入规范,帮助生态链公司提高生产效率.",
5
5
  "main": "index.js",
6
6
  "scripts": {
7
- "test": "echo \"Error: no test specified\" && exit 1"
7
+ "build": "babel src -d lib",
8
+ "obfuscate": "uglifyjs lib/*.js -o lib/index.min.js -m -c",
9
+ "prepare": "npm run build && npm run obfuscate"
8
10
  },
9
- "author": "lx",
10
- "license": "ISC"
11
+ "files": [
12
+ "lib/",
13
+ "index.js",
14
+ "package.json"
15
+ ],
16
+ "author": "liuxu",
17
+ "license": "ISC",
18
+ "devDependencies": {
19
+ "@babel/cli": "^7.25.9",
20
+ "@babel/preset-env": "^7.26.0",
21
+ "@babel/preset-react": "^7.25.9",
22
+ "babel-plugin-transform-remove-console": "^6.9.4",
23
+ "javascript-obfuscator": "^4.1.1",
24
+ "uglify-js": "^3.19.3"
25
+ },
26
+ "dependencies": {
27
+ },
28
+ "private": false
11
29
  }
package/index.min.js DELETED
@@ -1 +0,0 @@
1
- import{bleSpec}from"./main/specMethod";var appName="",Device={},Service={},addLog=function(){},Bluetooth={},localLog=function(){},bleSpecQueue=function(){},initSpecifications=function(e){appName=e.name,Device=e.Device,localLog=e.localLog,Service=e.Service,addLog=e.addLog,bleSpecQueue=bleSpec(Bluetooth=e.Bluetooth)};import{initSpecifications,bleSpecQueue}from"./global.js";import EcoService from"./main/EcoService.js";import{addLog,LogPage}from"./main/log.js";import{oneTrackReport,allTrackPoints}from"./eco-track-report/index.js";export{appName,Device,Service,initSpecifications,addLog,Bluetooth,bleSpecQueue,localLog,LogPage,addLog,bleSpecQueue,initSpecifications,EcoService,oneTrackReport,allTrackPoints};
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes
File without changes