buttplug 3.1.0 → 3.2.0

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.
Files changed (74) hide show
  1. package/.eslintrc.js +13 -8
  2. package/CHANGELOG.md +24 -0
  3. package/README.md +24 -25
  4. package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.d.ts +13 -16
  5. package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js +23 -57
  6. package/dist/main/src/client/ButtplugBrowserWebsocketClientConnector.js.map +1 -1
  7. package/dist/main/src/client/ButtplugClientConnectorException.d.ts +11 -11
  8. package/dist/main/src/client/ButtplugClientConnectorException.js +41 -41
  9. package/dist/main/src/client/ButtplugClientDevice.d.ts +67 -68
  10. package/dist/main/src/client/ButtplugClientDevice.js +324 -324
  11. package/dist/main/src/client/ButtplugClientDevice.js.map +1 -1
  12. package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.d.ts +18 -19
  13. package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js +19 -21
  14. package/dist/main/src/client/ButtplugNodeWebsocketClientConnector.js.map +1 -1
  15. package/dist/main/src/client/Client.d.ts +41 -41
  16. package/dist/main/src/client/Client.js +240 -235
  17. package/dist/main/src/client/Client.js.map +1 -1
  18. package/dist/main/src/client/IButtplugClientConnector.d.ts +16 -17
  19. package/dist/main/src/client/IButtplugClientConnector.js +9 -9
  20. package/dist/main/src/core/Exceptions.d.ts +36 -36
  21. package/dist/main/src/core/Exceptions.js +106 -106
  22. package/dist/main/src/core/Logging.d.ts +112 -113
  23. package/dist/main/src/core/Logging.js +170 -170
  24. package/dist/main/src/core/Logging.js.map +1 -1
  25. package/dist/main/src/core/MessageUtils.d.ts +9 -9
  26. package/dist/main/src/core/MessageUtils.js +58 -58
  27. package/dist/main/src/core/Messages.d.ts +275 -275
  28. package/dist/main/src/core/Messages.js +429 -429
  29. package/dist/main/src/core/Messages.js.map +1 -1
  30. package/dist/main/src/index.d.ts +18 -18
  31. package/dist/main/src/index.js +34 -34
  32. package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.d.ts +22 -24
  33. package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js +95 -102
  34. package/dist/main/src/utils/ButtplugBrowserWebsocketConnector.js.map +1 -1
  35. package/dist/main/src/utils/ButtplugMessageSorter.d.ts +19 -19
  36. package/dist/main/src/utils/ButtplugMessageSorter.js +81 -81
  37. package/dist/main/src/utils/Utils.d.ts +1 -1
  38. package/dist/main/src/utils/Utils.js +7 -7
  39. package/dist/web/buttplug.js +38 -7616
  40. package/dist/web/buttplug.mjs +2254 -0
  41. package/dist/web/client/ButtplugBrowserWebsocketClientConnector.d.ts +13 -0
  42. package/dist/web/client/ButtplugClientConnectorException.d.ts +11 -0
  43. package/dist/web/client/ButtplugClientDevice.d.ts +67 -0
  44. package/dist/web/client/ButtplugNodeWebsocketClientConnector.d.ts +18 -0
  45. package/dist/web/client/Client.d.ts +41 -0
  46. package/dist/web/client/IButtplugClientConnector.d.ts +16 -0
  47. package/dist/web/core/Exceptions.d.ts +36 -0
  48. package/dist/web/core/Logging.d.ts +112 -0
  49. package/dist/web/core/MessageUtils.d.ts +9 -0
  50. package/dist/web/core/Messages.d.ts +274 -0
  51. package/dist/web/index.d.ts +18 -0
  52. package/dist/web/utils/ButtplugBrowserWebsocketConnector.d.ts +22 -0
  53. package/dist/web/utils/ButtplugMessageSorter.d.ts +19 -0
  54. package/dist/web/utils/Utils.d.ts +1 -0
  55. package/node-test.ts +5 -0
  56. package/package.json +23 -53
  57. package/src/client/ButtplugBrowserWebsocketClientConnector.ts +2 -28
  58. package/src/client/ButtplugClientDevice.ts +2 -2
  59. package/src/client/ButtplugNodeWebsocketClientConnector.ts +0 -2
  60. package/src/client/Client.ts +13 -7
  61. package/src/client/IButtplugClientConnector.ts +5 -5
  62. package/src/core/Logging.ts +1 -1
  63. package/src/core/MessageUtils.ts +1 -1
  64. package/src/utils/ButtplugBrowserWebsocketConnector.ts +14 -20
  65. package/vite.config.ts +26 -0
  66. package/.github/FUNDING.yml +0 -5
  67. package/.github/ISSUE_TEMPLATE/bug_report.md +0 -17
  68. package/.github/workflows/docs.yaml +0 -29
  69. package/azure-pipelines.yml +0 -19
  70. package/dist/web/buttplug.min.js +0 -3
  71. package/dist/web/buttplug.min.js.LICENSE.txt +0 -31
  72. package/dist/web/buttplug.min.js.map +0 -1
  73. package/jest-puppeteer.config.js +0 -5
  74. package/rollup.config.js +0 -55
package/.eslintrc.js CHANGED
@@ -5,16 +5,21 @@ module.exports = {
5
5
  node: true,
6
6
  },
7
7
  extends: [
8
- "eslint:recommended",
9
- "plugin:@typescript-eslint/recommended",
10
- "./node_modules/gts",
8
+ 'eslint:recommended',
9
+ 'plugin:@typescript-eslint/recommended',
10
+ './node_modules/gts',
11
11
  ],
12
12
  overrides: [],
13
- parser: "@typescript-eslint/parser",
13
+ parser: '@typescript-eslint/parser',
14
14
  parserOptions: {
15
- ecmaVersion: "latest",
16
- sourceType: "module",
15
+ ecmaVersion: 'latest',
16
+ sourceType: 'module',
17
+ },
18
+ plugins: ['@typescript-eslint'],
19
+ rules: {
20
+ 'node/no-unsupported-features/es-syntax': [
21
+ 'error',
22
+ { ignores: ['modules'] },
23
+ ],
17
24
  },
18
- plugins: ["@typescript-eslint"],
19
- rules: {},
20
25
  };
package/CHANGELOG.md CHANGED
@@ -1,3 +1,27 @@
1
+ # v3.2.0 (2023/09/23)
2
+
3
+ ## Features
4
+
5
+ - Web package building now uses vite instead of webpack
6
+ - Long live vite. May I never have to fucking deal with webpack ever again.
7
+
8
+ ## Bugfixes
9
+
10
+ - Cleaned up naming conventions
11
+ - Changed connector interface (this is technically a breaking change but afaik no one else
12
+ implements their own connector)
13
+ - Fix linear attribute enumeration
14
+
15
+ # v3.1.1 (2023/02/18)
16
+
17
+ ## Bugfixes
18
+
19
+ - Replace events with eventemitter3
20
+ - API Compatible and easier for building across web/node
21
+ - Remove blob reading from websocket connectors
22
+ - We never use binary messages on websockets, and the extra filereader dep for node was
23
+ causing issues with web builds.
24
+
1
25
  # v3.1.0 (2023/02/11)
2
26
 
3
27
  ## Features
package/README.md CHANGED
@@ -7,41 +7,40 @@
7
7
  [![Discord](https://img.shields.io/discord/353303527587708932.svg?logo=discord)](https://discord.buttplug.io)
8
8
  [![Twitter](https://img.shields.io/twitter/follow/buttplugio.svg?style=social&logo=twitter)](https://twitter.com/buttplugio)
9
9
 
10
- This repo houses are pure .Net version of the Buttplug Typescript/Javascript Client, implementing
11
- the Version 3 Buttplug Spec. It is expected to run from a browser against either [Intiface Central
12
- (GUI)](https://intiface.com/central) or [Initface Engine
13
- (CLI)](https://github.com/intiface/intiface-engine). No Rust FFI bindings are required.
10
+ A implementation of the Buttplug Client in Typescript/Javascript, implementing the Version 3
11
+ Buttplug Spec. It is expected to run from a browser against either [Intiface Central
12
+ (GUI)](https://intiface.com/central), [Initface Engine
13
+ (CLI)](https://github.com/intiface/intiface-engine), or [the Buttplug WASM Server](https://github.com/buttplugio/buttplug-js).
14
14
 
15
+ ## Compilation information
15
16
 
16
- ## Using buttplug-js with Node
17
+ buttplug-js builds to 3 different types of library:
17
18
 
18
- buttplug-js works with both pure web builds, as well as node applications. To use buttplug-js with node, use the `ButtplugNodeWebsocketClientConnector` class instead of the `ButtplugBrowserWebsocketClientConnector` class. That should be the only change needed, all of the API stays the same. See the Documentation section for more info.
19
+ - CommonJS for node
20
+ - UMD and ES Modules for the web
19
21
 
20
- ## Documentation
22
+ For node, simply include the package as you would any other package.
21
23
 
22
- Documentation on how to use Buttplug in general, as well as examples for buttplug-js, can be found in the [Buttplug Developer Guide](https://docs.buttplug.io/docs/dev-guide).
24
+ For inclusion in web projects, the UMD project can be found at dist/web/buttplug.js, and the es6 module at dist/web/buttplug.mjs.
23
25
 
24
- API documentation for buttplug-js can be found at https://buttplugio.github.io/buttplug-js.
26
+ ## Using buttplug-js with Node
25
27
 
26
- ## What happened? Why is buttplug-js back?
28
+ buttplug-js works with both pure web builds, as well as node applications. To use buttplug-js with
29
+ node, use the `ButtplugNodeWebsocketClientConnector` class instead of the
30
+ `ButtplugBrowserWebsocketClientConnector` class. That should be the only change needed, all of the
31
+ API stays the same. See the Documentation section for more info.
27
32
 
28
- For those of you that have been around a while, you may remember that this used to be the main
29
- Typescript/Javascript implementation. From 2017 to 2020, it was a reference version of the Buttplug
30
- Intimate Haptics Control Standard.
33
+ (The WASM Server *does not work* with pure node applications. It requires a browser environment in order to run. See the WASM project README for more info.)
31
34
 
32
- Then I rewrote everything in Rust because I like Rust more and it's far easier for me to port across
33
- platforms. This repo was archived ~2 years ago in preference to seating the C# client *and* server
34
- on top of the [Rust implementation of Buttplug](https://github.com/buttplugio/buttplug), as part of
35
- the [Rust FFI Project](https://github.com/buttplugio/buttplug-rs-ffi).
35
+ ## Documentation and Examples
36
+
37
+ Documentation on how to use Buttplug in general, as well as examples for buttplug-js, can be found in the [Buttplug Developer Guide](https://docs.buttplug.io/docs/dev-guide).
38
+
39
+ API documentation for buttplug-js can be found at https://buttplugio.github.io/buttplug-js.
36
40
 
37
- That project ended up being a partial failure.
41
+ If you would like to see a demo of using Buttplug in a pure web context, check out the following glitch project, which shows how to pull the Buttplug libraries from a CDN and use them in a pure HTML/JS context without node:
38
42
 
39
- While the FFI system is handy for languages where it is very difficult to rebuild some parts of the
40
- library (C/C++/Java/etc...), for managed langauges like Javascript and C#, requiring both the client
41
- and server to use the FFI was overkill, and caused many extremely difficult-to-debug issues. With
42
- that in mind, the Typescript implementation in this repo is being turned into a Client only. The
43
- WASM server and Embedded Connector will stay in the FFI repo, but will be another NPM package that
44
- will be optional.
43
+ https://glitch.com/edit/#!/how-to-buttplug
45
44
 
46
45
  ## Contributing
47
46
 
@@ -69,7 +68,7 @@ This project is BSD 3-Clause licensed.
69
68
 
70
69
  ```text
71
70
 
72
- Copyright (c) 2016-2023, Nonpolynomial, LLC
71
+ Copyright (c) 2016-2023, Nonpolynomial Labs, LLC
73
72
  All rights reserved.
74
73
 
75
74
  Redistribution and use in source and binary forms, with or without
@@ -1,16 +1,13 @@
1
- /*!
2
- * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
- * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
- * project root for full license information.
5
- *
6
- * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
- */
8
- import { IButtplugClientConnector } from './IButtplugClientConnector';
9
- import { ButtplugMessage } from '../core/Messages';
10
- import { ButtplugBrowserWebsocketConnector } from '../utils/ButtplugBrowserWebsocketConnector';
11
- export declare class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector implements IButtplugClientConnector {
12
- private _sorter;
13
- Send: (msg: ButtplugMessage) => Promise<ButtplugMessage>;
14
- protected ParseIncomingMessage: (event: MessageEvent) => void;
15
- protected OnReaderLoad(event: Event): void;
16
- }
1
+ /*!
2
+ * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
+ * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
+ * project root for full license information.
5
+ *
6
+ * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
+ */
8
+ import { IButtplugClientConnector } from './IButtplugClientConnector';
9
+ import { ButtplugMessage } from '../core/Messages';
10
+ import { ButtplugBrowserWebsocketConnector } from '../utils/ButtplugBrowserWebsocketConnector';
11
+ export declare class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector implements IButtplugClientConnector {
12
+ send: (msg: ButtplugMessage) => void;
13
+ }
@@ -1,58 +1,24 @@
1
- /*!
2
- * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
- * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
- * project root for full license information.
5
- *
6
- * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
- */
8
- 'use strict';
9
- var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
10
- function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
11
- return new (P || (P = Promise))(function (resolve, reject) {
12
- function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
13
- function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
14
- function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
15
- step((generator = generator.apply(thisArg, _arguments || [])).next());
16
- });
17
- };
18
- Object.defineProperty(exports, "__esModule", { value: true });
19
- exports.ButtplugBrowserWebsocketClientConnector = void 0;
20
- const MessageUtils_1 = require("../core/MessageUtils");
21
- const ButtplugMessageSorter_1 = require("../utils/ButtplugMessageSorter");
22
- const ButtplugBrowserWebsocketConnector_1 = require("../utils/ButtplugBrowserWebsocketConnector");
23
- class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector_1.ButtplugBrowserWebsocketConnector {
24
- constructor() {
25
- super(...arguments);
26
- this._sorter = new ButtplugMessageSorter_1.ButtplugMessageSorter(true);
27
- this.Send = (msg) => __awaiter(this, void 0, void 0, function* () {
28
- if (!this.Connected) {
29
- throw new Error('ButtplugClient not connected');
30
- }
31
- const p = this._sorter.PrepareOutgoingMessage(msg);
32
- this.SendMessage(msg);
33
- return yield p;
34
- });
35
- this.ParseIncomingMessage = (event) => {
36
- var _a;
37
- if (typeof event.data === 'string') {
38
- const msgs = (0, MessageUtils_1.FromJSON)(event.data);
39
- const emitMsgs = this._sorter.ParseIncomingMessages(msgs);
40
- this.emit('message', emitMsgs);
41
- }
42
- else if (event.data instanceof Blob) {
43
- const reader = new ((_a = this._filereaderConstructor) !== null && _a !== void 0 ? _a : FileReader)();
44
- reader.addEventListener('load', (ev) => {
45
- this.OnReaderLoad(ev);
46
- });
47
- reader.readAsText(event.data);
48
- }
49
- };
50
- }
51
- OnReaderLoad(event) {
52
- const msgs = (0, MessageUtils_1.FromJSON)(event.target.result);
53
- const emitMsgs = this._sorter.ParseIncomingMessages(msgs);
54
- this.emit('message', emitMsgs);
55
- }
56
- }
57
- exports.ButtplugBrowserWebsocketClientConnector = ButtplugBrowserWebsocketClientConnector;
1
+ /*!
2
+ * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
+ * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
+ * project root for full license information.
5
+ *
6
+ * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
+ */
8
+ 'use strict';
9
+ Object.defineProperty(exports, "__esModule", { value: true });
10
+ exports.ButtplugBrowserWebsocketClientConnector = void 0;
11
+ const ButtplugBrowserWebsocketConnector_1 = require("../utils/ButtplugBrowserWebsocketConnector");
12
+ class ButtplugBrowserWebsocketClientConnector extends ButtplugBrowserWebsocketConnector_1.ButtplugBrowserWebsocketConnector {
13
+ constructor() {
14
+ super(...arguments);
15
+ this.send = (msg) => {
16
+ if (!this.Connected) {
17
+ throw new Error('ButtplugClient not connected');
18
+ }
19
+ this.sendMessage(msg);
20
+ };
21
+ }
22
+ }
23
+ exports.ButtplugBrowserWebsocketClientConnector = ButtplugBrowserWebsocketClientConnector;
58
24
  //# sourceMappingURL=ButtplugBrowserWebsocketClientConnector.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ButtplugBrowserWebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/client/ButtplugBrowserWebsocketClientConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;;;;;;;;;;;AAIb,uDAAgD;AAChD,0EAAuE;AACvE,kGAA+F;AAE/F,MAAa,uCACX,SAAQ,qEAAiC;IAD3C;;QAIU,YAAO,GAA0B,IAAI,6CAAqB,CAAC,IAAI,CAAC,CAAC;QAElE,SAAI,GAAG,CAAO,GAAoB,EAA4B,EAAE;YACrE,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACjD;YACD,MAAM,CAAC,GAAG,IAAI,CAAC,OAAO,CAAC,sBAAsB,CAAC,GAAG,CAAC,CAAC;YACnD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;YACtB,OAAO,MAAM,CAAC,CAAC;QACjB,CAAC,CAAA,CAAC;QAEQ,yBAAoB,GAAG,CAAC,KAAmB,EAAE,EAAE;;YACvD,IAAI,OAAO,KAAK,CAAC,IAAI,KAAK,QAAQ,EAAE;gBAClC,MAAM,IAAI,GAAG,IAAA,uBAAQ,EAAC,KAAK,CAAC,IAAI,CAAC,CAAC;gBAClC,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;gBAC1D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;aAChC;iBAAM,IAAI,KAAK,CAAC,IAAI,YAAY,IAAI,EAAE;gBACrC,MAAM,MAAM,GAAG,IAAI,CAAC,MAAA,IAAI,CAAC,sBAAsB,mCAAI,UAAU,CAAC,EAAE,CAAC;gBACjE,MAAM,CAAC,gBAAgB,CAAC,MAAM,EAAE,CAAC,EAAE,EAAE,EAAE;oBACrC,IAAI,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;gBACxB,CAAC,CAAC,CAAC;gBACH,MAAM,CAAC,UAAU,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;aAC/B;QACH,CAAC,CAAC;IAOJ,CAAC;IALW,YAAY,CAAC,KAAY;QACjC,MAAM,IAAI,GAAG,IAAA,uBAAQ,EAAE,KAAK,CAAC,MAAqB,CAAC,MAAM,CAAC,CAAC;QAC3D,MAAM,QAAQ,GAAG,IAAI,CAAC,OAAO,CAAC,qBAAqB,CAAC,IAAI,CAAC,CAAC;QAC1D,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IACjC,CAAC;CACF;AAlCD,0FAkCC"}
1
+ {"version":3,"file":"ButtplugBrowserWebsocketClientConnector.js","sourceRoot":"","sources":["../../../../src/client/ButtplugBrowserWebsocketClientConnector.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;;AAIb,kGAA+F;AAE/F,MAAa,uCACX,SAAQ,qEAAiC;IAD3C;;QAIS,SAAI,GAAG,CAAC,GAAoB,EAAQ,EAAE;YAC3C,IAAI,CAAC,IAAI,CAAC,SAAS,EAAE;gBACnB,MAAM,IAAI,KAAK,CAAC,8BAA8B,CAAC,CAAC;aACjD;YACD,IAAI,CAAC,WAAW,CAAC,GAAG,CAAC,CAAC;QACxB,CAAC,CAAC;IACJ,CAAC;CAAA;AAVD,0FAUC"}
@@ -1,11 +1,11 @@
1
- /*!
2
- * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
- * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
- * project root for full license information.
5
- *
6
- * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
- */
8
- import { ButtplugError } from '../core/Exceptions';
9
- export declare class ButtplugClientConnectorException extends ButtplugError {
10
- constructor(message: string);
11
- }
1
+ /*!
2
+ * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
+ * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
+ * project root for full license information.
5
+ *
6
+ * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
+ */
8
+ import { ButtplugError } from '../core/Exceptions';
9
+ export declare class ButtplugClientConnectorException extends ButtplugError {
10
+ constructor(message: string);
11
+ }
@@ -1,42 +1,42 @@
1
- "use strict";
2
- /*!
3
- * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
4
- * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
5
- * project root for full license information.
6
- *
7
- * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
8
- */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.ButtplugClientConnectorException = void 0;
34
- const Exceptions_1 = require("../core/Exceptions");
35
- const Messages = __importStar(require("../core/Messages"));
36
- class ButtplugClientConnectorException extends Exceptions_1.ButtplugError {
37
- constructor(message) {
38
- super(message, Messages.ErrorClass.ERROR_UNKNOWN);
39
- }
40
- }
41
- exports.ButtplugClientConnectorException = ButtplugClientConnectorException;
1
+ "use strict";
2
+ /*!
3
+ * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
4
+ * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
5
+ * project root for full license information.
6
+ *
7
+ * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
8
+ */
9
+ var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
+ if (k2 === undefined) k2 = k;
11
+ var desc = Object.getOwnPropertyDescriptor(m, k);
12
+ if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
+ desc = { enumerable: true, get: function() { return m[k]; } };
14
+ }
15
+ Object.defineProperty(o, k2, desc);
16
+ }) : (function(o, m, k, k2) {
17
+ if (k2 === undefined) k2 = k;
18
+ o[k2] = m[k];
19
+ }));
20
+ var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
+ Object.defineProperty(o, "default", { enumerable: true, value: v });
22
+ }) : function(o, v) {
23
+ o["default"] = v;
24
+ });
25
+ var __importStar = (this && this.__importStar) || function (mod) {
26
+ if (mod && mod.__esModule) return mod;
27
+ var result = {};
28
+ if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
+ __setModuleDefault(result, mod);
30
+ return result;
31
+ };
32
+ Object.defineProperty(exports, "__esModule", { value: true });
33
+ exports.ButtplugClientConnectorException = void 0;
34
+ const Exceptions_1 = require("../core/Exceptions");
35
+ const Messages = __importStar(require("../core/Messages"));
36
+ class ButtplugClientConnectorException extends Exceptions_1.ButtplugError {
37
+ constructor(message) {
38
+ super(message, Messages.ErrorClass.ERROR_UNKNOWN);
39
+ }
40
+ }
41
+ exports.ButtplugClientConnectorException = ButtplugClientConnectorException;
42
42
  //# sourceMappingURL=ButtplugClientConnectorException.js.map
@@ -1,68 +1,67 @@
1
- /*!
2
- * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
- * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
- * project root for full license information.
5
- *
6
- * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
- */
8
- /// <reference types="node" />
9
- import * as Messages from '../core/Messages';
10
- import { EventEmitter } from 'events';
11
- /**
12
- * Represents an abstract device, capable of taking certain kinds of messages.
13
- */
14
- export declare class ButtplugClientDevice extends EventEmitter {
15
- private _deviceInfo;
16
- private _sendClosure;
17
- /**
18
- * Return the name of the device.
19
- */
20
- get name(): string;
21
- /**
22
- * Return the user set name of the device.
23
- */
24
- get displayName(): string | undefined;
25
- /**
26
- * Return the index of the device.
27
- */
28
- get index(): number;
29
- /**
30
- * Return the index of the device.
31
- */
32
- get messageTimingGap(): number | undefined;
33
- /**
34
- * Return a list of message types the device accepts.
35
- */
36
- get messageAttributes(): Messages.MessageAttributes;
37
- static fromMsg(msg: Messages.DeviceInfo, sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>): ButtplugClientDevice;
38
- private allowedMsgs;
39
- /**
40
- * @param _index Index of the device, as created by the device manager.
41
- * @param _name Name of the device.
42
- * @param allowedMsgs Buttplug messages the device can receive.
43
- */
44
- constructor(_deviceInfo: Messages.DeviceInfo, _sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>);
45
- send(msg: Messages.ButtplugDeviceMessage): Promise<Messages.ButtplugMessage>;
46
- sendExpectOk(msg: Messages.ButtplugDeviceMessage): Promise<void>;
47
- scalar(scalar: Messages.ScalarSubcommand | Messages.ScalarSubcommand[]): Promise<void>;
48
- private scalarCommandBuilder;
49
- get vibrateAttributes(): Messages.GenericDeviceMessageAttributes[];
50
- vibrate(speed: number | number[]): Promise<void>;
51
- get oscillateAttributes(): Messages.GenericDeviceMessageAttributes[];
52
- oscillate(speed: number | number[]): Promise<void>;
53
- get rotateAttributes(): Messages.GenericDeviceMessageAttributes[];
54
- rotate(values: number | [number, boolean][], clockwise?: boolean): Promise<void>;
55
- get linearAttributes(): Messages.GenericDeviceMessageAttributes[];
56
- linear(values: number | [number, number][], duration?: number): Promise<void>;
57
- sensorRead(sensorIndex: number, sensorType: Messages.SensorType): Promise<number[]>;
58
- get hasBattery(): boolean;
59
- battery(): Promise<number>;
60
- get hasRssi(): boolean;
61
- rssi(): Promise<number>;
62
- rawRead(endpoint: string, expectedLength: number, timeout: number): Promise<Uint8Array>;
63
- rawWrite(endpoint: string, data: Uint8Array, writeWithResponse: boolean): Promise<void>;
64
- rawSubscribe(endpoint: string): Promise<void>;
65
- rawUnsubscribe(endpoint: string): Promise<void>;
66
- stop(): Promise<void>;
67
- emitDisconnected(): void;
68
- }
1
+ /*!
2
+ * Buttplug JS Source Code File - Visit https://buttplug.io for more info about
3
+ * the project. Licensed under the BSD 3-Clause license. See LICENSE file in the
4
+ * project root for full license information.
5
+ *
6
+ * @copyright Copyright (c) Nonpolynomial Labs LLC. All rights reserved.
7
+ */
8
+ import * as Messages from '../core/Messages';
9
+ import { EventEmitter } from 'eventemitter3';
10
+ /**
11
+ * Represents an abstract device, capable of taking certain kinds of messages.
12
+ */
13
+ export declare class ButtplugClientDevice extends EventEmitter {
14
+ private _deviceInfo;
15
+ private _sendClosure;
16
+ /**
17
+ * Return the name of the device.
18
+ */
19
+ get name(): string;
20
+ /**
21
+ * Return the user set name of the device.
22
+ */
23
+ get displayName(): string | undefined;
24
+ /**
25
+ * Return the index of the device.
26
+ */
27
+ get index(): number;
28
+ /**
29
+ * Return the index of the device.
30
+ */
31
+ get messageTimingGap(): number | undefined;
32
+ /**
33
+ * Return a list of message types the device accepts.
34
+ */
35
+ get messageAttributes(): Messages.MessageAttributes;
36
+ static fromMsg(msg: Messages.DeviceInfo, sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>): ButtplugClientDevice;
37
+ private allowedMsgs;
38
+ /**
39
+ * @param _index Index of the device, as created by the device manager.
40
+ * @param _name Name of the device.
41
+ * @param allowedMsgs Buttplug messages the device can receive.
42
+ */
43
+ constructor(_deviceInfo: Messages.DeviceInfo, _sendClosure: (device: ButtplugClientDevice, msg: Messages.ButtplugDeviceMessage) => Promise<Messages.ButtplugMessage>);
44
+ send(msg: Messages.ButtplugDeviceMessage): Promise<Messages.ButtplugMessage>;
45
+ sendExpectOk(msg: Messages.ButtplugDeviceMessage): Promise<void>;
46
+ scalar(scalar: Messages.ScalarSubcommand | Messages.ScalarSubcommand[]): Promise<void>;
47
+ private scalarCommandBuilder;
48
+ get vibrateAttributes(): Messages.GenericDeviceMessageAttributes[];
49
+ vibrate(speed: number | number[]): Promise<void>;
50
+ get oscillateAttributes(): Messages.GenericDeviceMessageAttributes[];
51
+ oscillate(speed: number | number[]): Promise<void>;
52
+ get rotateAttributes(): Messages.GenericDeviceMessageAttributes[];
53
+ rotate(values: number | [number, boolean][], clockwise?: boolean): Promise<void>;
54
+ get linearAttributes(): Messages.GenericDeviceMessageAttributes[];
55
+ linear(values: number | [number, number][], duration?: number): Promise<void>;
56
+ sensorRead(sensorIndex: number, sensorType: Messages.SensorType): Promise<number[]>;
57
+ get hasBattery(): boolean;
58
+ battery(): Promise<number>;
59
+ get hasRssi(): boolean;
60
+ rssi(): Promise<number>;
61
+ rawRead(endpoint: string, expectedLength: number, timeout: number): Promise<Uint8Array>;
62
+ rawWrite(endpoint: string, data: Uint8Array, writeWithResponse: boolean): Promise<void>;
63
+ rawSubscribe(endpoint: string): Promise<void>;
64
+ rawUnsubscribe(endpoint: string): Promise<void>;
65
+ stop(): Promise<void>;
66
+ emitDisconnected(): void;
67
+ }