Skip to content

Refactor naming, simplify structure, and improve documentation#42

Merged
Zendrex merged 6 commits into
mainfrom
dev
Jun 9, 2026
Merged

Refactor naming, simplify structure, and improve documentation#42
Zendrex merged 6 commits into
mainfrom
dev

Conversation

@Zendrex

@Zendrex Zendrex commented Jun 9, 2026

Copy link
Copy Markdown
Owner

Addresses #39 as well as documentation, package updates and general code cleanup. This update includes minor breaking changes addressed in the changeset.

Patterns (@zendrex/buttplug.js/patterns):

  • PatternEngineClientPatternClient
  • getPresetInfolistPresets (module export; PatternEngine.listPresets() unchanged in name)
  • PresetInfo.compatibleOutputTypesoutputTypes
  • PatternEngine.play(device, …)play(target, …) (parameter rename only)

Sensors (DeviceMessageSender / custom client implementors):

  • registerSensorSubscriptionregisterSensor
  • unregisterSensorSubscriptionunregisterSensor

Feature helpers (deep imports from ./protocol/features):

  • getOutputsByTypeoutputsByType
  • getInputsByTypeinputsByType

Wasm transport (@zendrex/buttplug.js/wasm):

  • WasmTransportOptions.enableWasmLoggingenableLogging
  • WasmTransportOptions.wasmLogLevellogLevel

Zendrex added 6 commits May 26, 2026 02:54
Rename exports and options for clearer roles after a naming audit;
peer review kept disambiguating names (clientName, featureIndex) while
applying prefix fixes and pattern/wasm surface improvements.
Conform pass across src: remove dead code, fold single-use
helpers, and centralize duplicated logic.

- transport: extract shared TransportEventEmitter base so
  WebSocketTransport and WasmTransport stop copy-pasting the
  listener registry and on/off/emit
- patterns: merge PatternDescriptor into track.ts and drop the
  one-line descriptor module
- protocol: remove unused TypedEmitter alias; read message Id via
  the typed union in parser; inline identity get* accessors
- features: replace the WeakMap index singleton with direct
  array filters
- builders/device: fold single-use guards; route Device.stop
  through createStopCmd; extract stop-target validation
- message-router: order system events via a stable priority sort
  with the DeviceList-before-ScanningFinished invariant named
- scheduler: use the canonical clampNormalized helper

Also fixes auto-reconnect re-arming: reconnect now arms only on
unexpected transport close, not on every connection.disconnected
emit. Explicit disconnect() — including server ping-timeout
teardown — no longer re-triggers reconnection.
@Zendrex Zendrex merged commit 7199c1b into main Jun 9, 2026
3 checks passed
@github-actions

github-actions Bot commented Jun 9, 2026

Copy link
Copy Markdown
Contributor

Preview published — install with:

bun

bun add https://pkg.pr.new/@zendrex/buttplug.js@9895811

npm

npm install https://pkg.pr.new/@zendrex/buttplug.js@9895811

Built from 9895811

@github-actions github-actions Bot mentioned this pull request Jun 9, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant