@microbit/microbit-connection 0.9.0-apps.alpha.16 → 0.9.0-apps.alpha.17
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/build/{esm/bluetooth.d.ts → cjs/bluetooth/connection.d.ts} +30 -26
- package/build/cjs/{bluetooth.js → bluetooth/connection.js} +147 -104
- package/build/cjs/bluetooth/connection.js.map +1 -0
- package/build/cjs/{bluetooth.test.js → bluetooth/connection.test.js} +9 -9
- package/build/cjs/bluetooth/connection.test.js.map +1 -0
- package/build/cjs/bluetooth/device-bond-state.js.map +1 -0
- package/build/cjs/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +11 -11
- package/build/cjs/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +35 -35
- package/build/cjs/bluetooth/device-wrapper.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-full.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-full.js +4 -4
- package/build/cjs/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.d.ts +1 -1
- package/build/cjs/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.test.js +3 -3
- package/build/cjs/bluetooth/flashing/flashing-makecode.test.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-partial.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/flashing-partial.js +5 -5
- package/build/cjs/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/cjs/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/cjs/{flashing → bluetooth/flashing}/nordic-dfu.js +11 -8
- package/build/cjs/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/cjs/bluetooth/flashing/zip.js.map +1 -0
- package/build/cjs/bluetooth/flashing/zip.test.js.map +1 -0
- package/build/cjs/bluetooth/index.d.ts +5 -0
- package/build/cjs/bluetooth/index.js +9 -0
- package/build/cjs/bluetooth/index.js.map +1 -0
- package/build/cjs/{bluetooth-profile.js → bluetooth/profile.js} +1 -1
- package/build/cjs/bluetooth/profile.js.map +1 -0
- package/build/cjs/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/cjs/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +16 -12
- package/build/cjs/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/button-service.d.ts +2 -3
- package/build/cjs/{button-service.js → bluetooth/services/button-service.js} +15 -14
- package/build/cjs/bluetooth/services/button-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/cjs/{device-information-service.js → bluetooth/services/device-information-service.js} +2 -2
- package/build/cjs/bluetooth/services/device-information-service.js.map +1 -0
- package/build/cjs/{dfu-service.js → bluetooth/services/dfu-service.js} +2 -2
- package/build/cjs/bluetooth/services/dfu-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/led-service.d.ts +2 -3
- package/build/cjs/{led-service.js → bluetooth/services/led-service.js} +7 -7
- package/build/cjs/bluetooth/services/led-service.js.map +1 -0
- package/build/cjs/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/cjs/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +18 -14
- package/build/cjs/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{esm → cjs/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/cjs/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +8 -8
- package/build/cjs/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/cjs/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/cjs/{uart-service.js → bluetooth/services/uart-service.js} +12 -9
- package/build/cjs/bluetooth/services/uart-service.js.map +1 -0
- package/build/cjs/board-id.d.ts +1 -1
- package/build/cjs/board-id.js.map +1 -1
- package/build/cjs/device.d.ts +82 -75
- package/build/cjs/device.js +40 -126
- package/build/cjs/device.js.map +1 -1
- package/build/cjs/events.d.ts +9 -108
- package/build/cjs/events.js +27 -88
- package/build/cjs/events.js.map +1 -1
- package/build/cjs/events.test.js +54 -48
- package/build/cjs/events.test.js.map +1 -1
- package/build/cjs/hex-util.d.ts +1 -0
- package/build/cjs/hex-util.js +15 -0
- package/build/cjs/hex-util.js.map +1 -0
- package/build/cjs/index.d.ts +7 -16
- package/build/cjs/index.js +6 -26
- package/build/cjs/index.js.map +1 -1
- package/build/cjs/radio-bridge/connection.d.ts +39 -0
- package/build/cjs/{usb-radio-bridge.js → radio-bridge/connection.js} +39 -25
- package/build/cjs/radio-bridge/connection.js.map +1 -0
- package/build/cjs/radio-bridge/index.d.ts +4 -0
- package/build/cjs/radio-bridge/index.js +9 -0
- package/build/cjs/radio-bridge/index.js.map +1 -0
- package/build/cjs/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/cjs/radio-bridge/serial-protocol.js.map +1 -0
- package/build/cjs/service-events.d.ts +42 -14
- package/build/cjs/service-events.js +6 -36
- package/build/cjs/service-events.js.map +1 -1
- package/build/{esm/hex-flash-data-source.d.ts → cjs/universal-hex/flash-data-source.d.ts} +1 -2
- package/build/cjs/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +7 -15
- package/build/cjs/universal-hex/flash-data-source.js.map +1 -0
- package/build/cjs/universal-hex/index.d.ts +4 -0
- package/build/cjs/universal-hex/index.js +9 -0
- package/build/cjs/universal-hex/index.js.map +1 -0
- package/build/cjs/usb/arm-debug.d.ts +137 -0
- package/build/cjs/usb/arm-debug.js +414 -0
- package/build/cjs/usb/arm-debug.js.map +1 -0
- package/build/cjs/usb/arm-debug.test.js +333 -0
- package/build/cjs/usb/arm-debug.test.js.map +1 -0
- package/build/{esm → cjs/usb}/board-serial-info.d.ts +2 -1
- package/build/cjs/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/cjs/usb/board-serial-info.js.map +1 -0
- package/build/cjs/{board-serial-info.test.js → usb/board-serial-info.test.js} +2 -4
- package/build/cjs/usb/board-serial-info.test.js.map +1 -0
- package/build/cjs/usb/cdc-saturation.d.ts +36 -0
- package/build/cjs/usb/cdc-saturation.js +151 -0
- package/build/cjs/usb/cdc-saturation.js.map +1 -0
- package/build/cjs/usb/cmsis-dap.d.ts +113 -0
- package/build/cjs/usb/cmsis-dap.js +349 -0
- package/build/cjs/usb/cmsis-dap.js.map +1 -0
- package/build/cjs/usb/cmsis-dap.test.js +350 -0
- package/build/cjs/usb/cmsis-dap.test.js.map +1 -0
- package/build/cjs/usb/connection.d.ts +81 -0
- package/build/cjs/{usb.js → usb/connection.js} +243 -166
- package/build/cjs/usb/connection.js.map +1 -0
- package/build/cjs/{usb.test.js → usb/connection.test.js} +52 -42
- package/build/cjs/usb/connection.test.js.map +1 -0
- package/build/cjs/usb/cortex-m.d.ts +72 -0
- package/build/cjs/usb/cortex-m.js +165 -0
- package/build/cjs/usb/cortex-m.js.map +1 -0
- package/build/cjs/usb/cortex-m.test.js +217 -0
- package/build/cjs/usb/cortex-m.test.js.map +1 -0
- package/build/cjs/usb/daplink.d.ts +69 -0
- package/build/cjs/usb/daplink.js +238 -0
- package/build/cjs/usb/daplink.js.map +1 -0
- package/build/cjs/usb/daplink.test.js +290 -0
- package/build/cjs/usb/daplink.test.js.map +1 -0
- package/build/cjs/usb/device-wrapper.d.ts +34 -0
- package/build/cjs/usb/device-wrapper.js +102 -0
- package/build/cjs/usb/device-wrapper.js.map +1 -0
- package/build/cjs/usb/index.d.ts +5 -0
- package/build/cjs/usb/index.js +10 -0
- package/build/cjs/usb/index.js.map +1 -0
- package/build/{esm/usb-partial-flashing-utils.d.ts → cjs/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/cjs/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +6 -49
- package/build/cjs/usb/partial-flashing-utils.js.map +1 -0
- package/build/{esm/usb-partial-flashing.d.ts → cjs/usb/partial-flashing.d.ts} +15 -7
- package/build/cjs/{usb-partial-flashing.js → usb/partial-flashing.js} +64 -119
- package/build/cjs/usb/partial-flashing.js.map +1 -0
- package/build/cjs/usb/promise-queue.js.map +1 -0
- package/build/cjs/usb/promise-queue.test.js.map +1 -0
- package/build/cjs/usb/serial-events.d.ts +21 -0
- package/build/cjs/{led.js → usb/serial-events.js} +1 -1
- package/build/cjs/usb/serial-events.js.map +1 -0
- package/build/cjs/usb/transport.d.ts +42 -0
- package/build/cjs/usb/transport.js +155 -0
- package/build/cjs/usb/transport.js.map +1 -0
- package/build/{cjs/bluetooth.d.ts → esm/bluetooth/connection.d.ts} +30 -26
- package/build/esm/{bluetooth.js → bluetooth/connection.js} +141 -98
- package/build/esm/bluetooth/connection.js.map +1 -0
- package/build/esm/{bluetooth.test.js → bluetooth/connection.test.js} +9 -9
- package/build/esm/bluetooth/connection.test.js.map +1 -0
- package/build/esm/bluetooth/device-bond-state.js.map +1 -0
- package/build/esm/{bluetooth-device-wrapper.d.ts → bluetooth/device-wrapper.d.ts} +11 -11
- package/build/esm/{bluetooth-device-wrapper.js → bluetooth/device-wrapper.js} +32 -32
- package/build/esm/bluetooth/device-wrapper.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-full.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/flashing-full.js +4 -4
- package/build/esm/bluetooth/flashing/flashing-full.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-makecode.d.ts +1 -1
- package/build/esm/bluetooth/flashing/flashing-makecode.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-makecode.test.js +2 -2
- package/build/esm/bluetooth/flashing/flashing-makecode.test.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/flashing-partial.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/flashing-partial.js +4 -4
- package/build/esm/bluetooth/flashing/flashing-partial.js.map +1 -0
- package/build/esm/bluetooth/flashing/flashing-v1.js.map +1 -0
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.d.ts +2 -2
- package/build/esm/{flashing → bluetooth/flashing}/nordic-dfu.js +11 -8
- package/build/esm/bluetooth/flashing/nordic-dfu.js.map +1 -0
- package/build/esm/bluetooth/flashing/zip.js.map +1 -0
- package/build/esm/bluetooth/flashing/zip.test.d.ts +1 -0
- package/build/esm/bluetooth/flashing/zip.test.js.map +1 -0
- package/build/esm/bluetooth/index.d.ts +5 -0
- package/build/esm/bluetooth/index.js +5 -0
- package/build/esm/bluetooth/index.js.map +1 -0
- package/build/esm/{bluetooth-profile.js → bluetooth/profile.js} +1 -1
- package/build/{cjs/bluetooth-profile.js.map → esm/bluetooth/profile.js.map} +1 -1
- package/build/esm/{accelerometer-service.d.ts → bluetooth/services/accelerometer-service.d.ts} +2 -3
- package/build/esm/{accelerometer-service.js → bluetooth/services/accelerometer-service.js} +10 -6
- package/build/esm/bluetooth/services/accelerometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/button-service.d.ts +2 -3
- package/build/esm/{button-service.js → bluetooth/services/button-service.js} +10 -9
- package/build/esm/bluetooth/services/button-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/device-information-service.d.ts +1 -1
- package/build/esm/{device-information-service.js → bluetooth/services/device-information-service.js} +1 -1
- package/build/esm/bluetooth/services/device-information-service.js.map +1 -0
- package/build/esm/{dfu-service.js → bluetooth/services/dfu-service.js} +1 -1
- package/build/esm/bluetooth/services/dfu-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/led-service.d.ts +2 -3
- package/build/esm/{led-service.js → bluetooth/services/led-service.js} +1 -1
- package/build/esm/bluetooth/services/led-service.js.map +1 -0
- package/build/esm/{magnetometer-service.d.ts → bluetooth/services/magnetometer-service.d.ts} +2 -3
- package/build/esm/{magnetometer-service.js → bluetooth/services/magnetometer-service.js} +10 -6
- package/build/esm/bluetooth/services/magnetometer-service.js.map +1 -0
- package/build/{cjs → esm/bluetooth/services}/partial-flashing-service.d.ts +1 -1
- package/build/esm/{partial-flashing-service.js → bluetooth/services/partial-flashing-service.js} +4 -4
- package/build/esm/bluetooth/services/partial-flashing-service.js.map +1 -0
- package/build/esm/{uart-service.d.ts → bluetooth/services/uart-service.d.ts} +2 -2
- package/build/esm/{uart-service.js → bluetooth/services/uart-service.js} +8 -5
- package/build/esm/bluetooth/services/uart-service.js.map +1 -0
- package/build/esm/board-id.d.ts +1 -1
- package/build/esm/board-id.js.map +1 -1
- package/build/esm/device.d.ts +82 -75
- package/build/esm/device.js +38 -120
- package/build/esm/device.js.map +1 -1
- package/build/esm/events.d.ts +9 -108
- package/build/esm/events.js +26 -86
- package/build/esm/events.js.map +1 -1
- package/build/esm/events.test.js +55 -49
- package/build/esm/events.test.js.map +1 -1
- package/build/esm/hex-util.d.ts +1 -0
- package/build/esm/hex-util.js +11 -0
- package/build/esm/hex-util.js.map +1 -0
- package/build/esm/index.d.ts +7 -16
- package/build/esm/index.js +6 -10
- package/build/esm/index.js.map +1 -1
- package/build/esm/radio-bridge/connection.d.ts +39 -0
- package/build/esm/{usb-radio-bridge.js → radio-bridge/connection.js} +39 -25
- package/build/esm/radio-bridge/connection.js.map +1 -0
- package/build/esm/radio-bridge/index.d.ts +4 -0
- package/build/esm/radio-bridge/index.js +5 -0
- package/build/esm/radio-bridge/index.js.map +1 -0
- package/build/esm/{usb-serial-protocol.js → radio-bridge/serial-protocol.js} +1 -1
- package/build/esm/radio-bridge/serial-protocol.js.map +1 -0
- package/build/esm/service-events.d.ts +42 -14
- package/build/esm/service-events.js +5 -34
- package/build/esm/service-events.js.map +1 -1
- package/build/{cjs/hex-flash-data-source.d.ts → esm/universal-hex/flash-data-source.d.ts} +1 -2
- package/build/esm/{hex-flash-data-source.js → universal-hex/flash-data-source.js} +6 -13
- package/build/esm/universal-hex/flash-data-source.js.map +1 -0
- package/build/esm/universal-hex/index.d.ts +4 -0
- package/build/esm/universal-hex/index.js +5 -0
- package/build/esm/universal-hex/index.js.map +1 -0
- package/build/esm/usb/arm-debug.d.ts +137 -0
- package/build/esm/usb/arm-debug.js +409 -0
- package/build/esm/usb/arm-debug.js.map +1 -0
- package/build/esm/usb/arm-debug.test.d.ts +1 -0
- package/build/esm/usb/arm-debug.test.js +331 -0
- package/build/esm/usb/arm-debug.test.js.map +1 -0
- package/build/{cjs → esm/usb}/board-serial-info.d.ts +2 -1
- package/build/esm/{board-serial-info.js → usb/board-serial-info.js} +10 -7
- package/build/esm/usb/board-serial-info.js.map +1 -0
- package/build/esm/usb/board-serial-info.test.d.ts +1 -0
- package/build/esm/{board-serial-info.test.js → usb/board-serial-info.test.js} +2 -4
- package/build/esm/usb/board-serial-info.test.js.map +1 -0
- package/build/esm/usb/cdc-saturation.d.ts +36 -0
- package/build/esm/usb/cdc-saturation.js +148 -0
- package/build/esm/usb/cdc-saturation.js.map +1 -0
- package/build/esm/usb/cmsis-dap.d.ts +113 -0
- package/build/esm/usb/cmsis-dap.js +342 -0
- package/build/esm/usb/cmsis-dap.js.map +1 -0
- package/build/esm/usb/cmsis-dap.test.d.ts +1 -0
- package/build/esm/usb/cmsis-dap.test.js +348 -0
- package/build/esm/usb/cmsis-dap.test.js.map +1 -0
- package/build/esm/usb/connection.d.ts +81 -0
- package/build/esm/{usb.js → usb/connection.js} +239 -161
- package/build/esm/usb/connection.js.map +1 -0
- package/build/esm/usb/connection.test.d.ts +1 -0
- package/build/esm/{usb.test.js → usb/connection.test.js} +47 -37
- package/build/esm/usb/connection.test.js.map +1 -0
- package/build/esm/usb/cortex-m.d.ts +72 -0
- package/build/esm/usb/cortex-m.js +161 -0
- package/build/esm/usb/cortex-m.js.map +1 -0
- package/build/esm/usb/cortex-m.test.d.ts +1 -0
- package/build/esm/usb/cortex-m.test.js +215 -0
- package/build/esm/usb/cortex-m.test.js.map +1 -0
- package/build/esm/usb/daplink.d.ts +69 -0
- package/build/esm/usb/daplink.js +231 -0
- package/build/esm/usb/daplink.js.map +1 -0
- package/build/esm/usb/daplink.test.d.ts +1 -0
- package/build/esm/usb/daplink.test.js +288 -0
- package/build/esm/usb/daplink.test.js.map +1 -0
- package/build/esm/usb/device-wrapper.d.ts +34 -0
- package/build/esm/usb/device-wrapper.js +98 -0
- package/build/esm/usb/device-wrapper.js.map +1 -0
- package/build/esm/usb/index.d.ts +5 -0
- package/build/esm/usb/index.js +5 -0
- package/build/esm/usb/index.js.map +1 -0
- package/build/{cjs/usb-partial-flashing-utils.d.ts → esm/usb/partial-flashing-utils.d.ts} +6 -9
- package/build/esm/{usb-partial-flashing-utils.js → usb/partial-flashing-utils.js} +4 -44
- package/build/esm/usb/partial-flashing-utils.js.map +1 -0
- package/build/{cjs/usb-partial-flashing.d.ts → esm/usb/partial-flashing.d.ts} +15 -7
- package/build/esm/{usb-partial-flashing.js → usb/partial-flashing.js} +62 -94
- package/build/esm/usb/partial-flashing.js.map +1 -0
- package/build/esm/usb/promise-queue.js.map +1 -0
- package/build/esm/usb/promise-queue.test.d.ts +1 -0
- package/build/esm/usb/promise-queue.test.js.map +1 -0
- package/build/esm/usb/serial-events.d.ts +21 -0
- package/build/esm/usb/serial-events.js +2 -0
- package/build/esm/usb/serial-events.js.map +1 -0
- package/build/esm/usb/transport.d.ts +42 -0
- package/build/esm/usb/transport.js +151 -0
- package/build/esm/usb/transport.js.map +1 -0
- package/package.json +43 -2
- package/build/cjs/accelerometer-service.js.map +0 -1
- package/build/cjs/accelerometer.d.ts +0 -9
- package/build/cjs/accelerometer.js +0 -16
- package/build/cjs/accelerometer.js.map +0 -1
- package/build/cjs/bluetooth-device-wrapper.js.map +0 -1
- package/build/cjs/bluetooth.js.map +0 -1
- package/build/cjs/bluetooth.test.js.map +0 -1
- package/build/cjs/board-serial-info.js.map +0 -1
- package/build/cjs/board-serial-info.test.js.map +0 -1
- package/build/cjs/button-service.js.map +0 -1
- package/build/cjs/buttons.d.ts +0 -10
- package/build/cjs/buttons.js +0 -22
- package/build/cjs/buttons.js.map +0 -1
- package/build/cjs/constants.d.ts +0 -48
- package/build/cjs/constants.js +0 -73
- package/build/cjs/constants.js.map +0 -1
- package/build/cjs/device-bond-state.js.map +0 -1
- package/build/cjs/device-information-service.js.map +0 -1
- package/build/cjs/dfu-service.js.map +0 -1
- package/build/cjs/flashing/flashing-full.js.map +0 -1
- package/build/cjs/flashing/flashing-makecode.js.map +0 -1
- package/build/cjs/flashing/flashing-makecode.test.js.map +0 -1
- package/build/cjs/flashing/flashing-partial.js.map +0 -1
- package/build/cjs/flashing/flashing-v1.js.map +0 -1
- package/build/cjs/flashing/nordic-dfu.js.map +0 -1
- package/build/cjs/flashing/zip.js.map +0 -1
- package/build/cjs/flashing/zip.test.js.map +0 -1
- package/build/cjs/hex-flash-data-source.js.map +0 -1
- package/build/cjs/led-service.js.map +0 -1
- package/build/cjs/led.d.ts +0 -6
- package/build/cjs/led.js.map +0 -1
- package/build/cjs/magnetometer-service.js.map +0 -1
- package/build/cjs/magnetometer.d.ts +0 -9
- package/build/cjs/magnetometer.js +0 -16
- package/build/cjs/magnetometer.js.map +0 -1
- package/build/cjs/partial-flashing-service.js.map +0 -1
- package/build/cjs/promise-queue.js.map +0 -1
- package/build/cjs/promise-queue.test.js.map +0 -1
- package/build/cjs/serial-events.d.ts +0 -20
- package/build/cjs/serial-events.js +0 -69
- package/build/cjs/serial-events.js.map +0 -1
- package/build/cjs/uart-service.js.map +0 -1
- package/build/cjs/uart.d.ts +0 -4
- package/build/cjs/uart.js +0 -16
- package/build/cjs/uart.js.map +0 -1
- package/build/cjs/usb-device-wrapper.d.ts +0 -47
- package/build/cjs/usb-device-wrapper.js +0 -437
- package/build/cjs/usb-device-wrapper.js.map +0 -1
- package/build/cjs/usb-partial-flashing-utils.js.map +0 -1
- package/build/cjs/usb-partial-flashing.js.map +0 -1
- package/build/cjs/usb-radio-bridge.d.ts +0 -24
- package/build/cjs/usb-radio-bridge.js.map +0 -1
- package/build/cjs/usb-serial-protocol.js.map +0 -1
- package/build/cjs/usb.d.ts +0 -66
- package/build/cjs/usb.js.map +0 -1
- package/build/cjs/usb.test.js.map +0 -1
- package/build/esm/accelerometer-service.js.map +0 -1
- package/build/esm/accelerometer.d.ts +0 -9
- package/build/esm/accelerometer.js +0 -12
- package/build/esm/accelerometer.js.map +0 -1
- package/build/esm/bluetooth-device-wrapper.js.map +0 -1
- package/build/esm/bluetooth-profile.js.map +0 -1
- package/build/esm/bluetooth.js.map +0 -1
- package/build/esm/bluetooth.test.js.map +0 -1
- package/build/esm/board-serial-info.js.map +0 -1
- package/build/esm/board-serial-info.test.js.map +0 -1
- package/build/esm/button-service.js.map +0 -1
- package/build/esm/buttons.d.ts +0 -10
- package/build/esm/buttons.js +0 -18
- package/build/esm/buttons.js.map +0 -1
- package/build/esm/constants.d.ts +0 -48
- package/build/esm/constants.js +0 -70
- package/build/esm/constants.js.map +0 -1
- package/build/esm/device-bond-state.js.map +0 -1
- package/build/esm/device-information-service.js.map +0 -1
- package/build/esm/dfu-service.js.map +0 -1
- package/build/esm/flashing/flashing-full.js.map +0 -1
- package/build/esm/flashing/flashing-makecode.js.map +0 -1
- package/build/esm/flashing/flashing-makecode.test.js.map +0 -1
- package/build/esm/flashing/flashing-partial.js.map +0 -1
- package/build/esm/flashing/flashing-v1.js.map +0 -1
- package/build/esm/flashing/nordic-dfu.js.map +0 -1
- package/build/esm/flashing/zip.js.map +0 -1
- package/build/esm/flashing/zip.test.js.map +0 -1
- package/build/esm/hex-flash-data-source.js.map +0 -1
- package/build/esm/led-service.js.map +0 -1
- package/build/esm/led.d.ts +0 -6
- package/build/esm/led.js +0 -2
- package/build/esm/led.js.map +0 -1
- package/build/esm/magnetometer-service.js.map +0 -1
- package/build/esm/magnetometer.d.ts +0 -9
- package/build/esm/magnetometer.js +0 -12
- package/build/esm/magnetometer.js.map +0 -1
- package/build/esm/partial-flashing-service.js.map +0 -1
- package/build/esm/promise-queue.js.map +0 -1
- package/build/esm/promise-queue.test.js.map +0 -1
- package/build/esm/serial-events.d.ts +0 -20
- package/build/esm/serial-events.js +0 -61
- package/build/esm/serial-events.js.map +0 -1
- package/build/esm/uart-service.js.map +0 -1
- package/build/esm/uart.d.ts +0 -4
- package/build/esm/uart.js +0 -12
- package/build/esm/uart.js.map +0 -1
- package/build/esm/usb-device-wrapper.d.ts +0 -47
- package/build/esm/usb-device-wrapper.js +0 -410
- package/build/esm/usb-device-wrapper.js.map +0 -1
- package/build/esm/usb-partial-flashing-utils.js.map +0 -1
- package/build/esm/usb-partial-flashing.js.map +0 -1
- package/build/esm/usb-radio-bridge.d.ts +0 -24
- package/build/esm/usb-radio-bridge.js.map +0 -1
- package/build/esm/usb-serial-protocol.js.map +0 -1
- package/build/esm/usb.d.ts +0 -66
- package/build/esm/usb.js.map +0 -1
- package/build/esm/usb.test.js.map +0 -1
- /package/build/cjs/{bluetooth.test.d.ts → bluetooth/connection.test.d.ts} +0 -0
- /package/build/cjs/{device-bond-state.d.ts → bluetooth/device-bond-state.d.ts} +0 -0
- /package/build/cjs/{device-bond-state.js → bluetooth/device-bond-state.js} +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.js +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-makecode.test.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.test.d.ts +0 -0
- /package/build/cjs/{flashing → bluetooth/flashing}/zip.test.js +0 -0
- /package/build/cjs/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +0 -0
- /package/build/cjs/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/cjs/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/cjs/{board-serial-info.test.d.ts → usb/arm-debug.test.d.ts} +0 -0
- /package/build/{esm → cjs/usb}/board-serial-info.test.d.ts +0 -0
- /package/build/cjs/{promise-queue.test.d.ts → usb/cmsis-dap.test.d.ts} +0 -0
- /package/build/cjs/{usb.test.d.ts → usb/connection.test.d.ts} +0 -0
- /package/build/{esm/bluetooth.test.d.ts → cjs/usb/cortex-m.test.d.ts} +0 -0
- /package/build/{esm/flashing/flashing-makecode.test.d.ts → cjs/usb/daplink.test.d.ts} +0 -0
- /package/build/cjs/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/cjs/{promise-queue.js → usb/promise-queue.js} +0 -0
- /package/build/{esm → cjs/usb}/promise-queue.test.d.ts +0 -0
- /package/build/cjs/{promise-queue.test.js → usb/promise-queue.test.js} +0 -0
- /package/build/esm/{flashing/zip.test.d.ts → bluetooth/connection.test.d.ts} +0 -0
- /package/build/esm/{device-bond-state.d.ts → bluetooth/device-bond-state.d.ts} +0 -0
- /package/build/esm/{device-bond-state.js → bluetooth/device-bond-state.js} +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-makecode.js +0 -0
- /package/build/esm/{usb.test.d.ts → bluetooth/flashing/flashing-makecode.test.d.ts} +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/flashing-v1.js +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.d.ts +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.js +0 -0
- /package/build/esm/{flashing → bluetooth/flashing}/zip.test.js +0 -0
- /package/build/esm/{bluetooth-profile.d.ts → bluetooth/profile.d.ts} +0 -0
- /package/build/esm/{dfu-service.d.ts → bluetooth/services/dfu-service.d.ts} +0 -0
- /package/build/esm/{usb-serial-protocol.d.ts → radio-bridge/serial-protocol.d.ts} +0 -0
- /package/build/esm/{promise-queue.d.ts → usb/promise-queue.d.ts} +0 -0
- /package/build/esm/{promise-queue.js → usb/promise-queue.js} +0 -0
- /package/build/esm/{promise-queue.test.js → usb/promise-queue.test.js} +0 -0
package/build/cjs/device.d.ts
CHANGED
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
*
|
|
4
4
|
* SPDX-License-Identifier: MIT
|
|
5
5
|
*/
|
|
6
|
-
import { TypedEventTarget
|
|
6
|
+
import { TypedEventTarget } from "./events.js";
|
|
7
7
|
/**
|
|
8
8
|
* Connection availability status returned by checkAvailability().
|
|
9
9
|
* Used for pre-flight UX decisions before attempting to connect.
|
|
@@ -40,9 +40,13 @@ export type DeviceErrorCode =
|
|
|
40
40
|
*/
|
|
41
41
|
| "timeout-error"
|
|
42
42
|
/**
|
|
43
|
-
* This is the fallback error case suggesting that the user reconnects their device.
|
|
43
|
+
* This is the fallback error case suggesting that the user physically reconnects their device.
|
|
44
44
|
*/
|
|
45
45
|
| "reconnect-microbit"
|
|
46
|
+
/**
|
|
47
|
+
* An operation was attempted that requires an active connection.
|
|
48
|
+
*/
|
|
49
|
+
| "not-connected"
|
|
46
50
|
/**
|
|
47
51
|
* Error occured during serial or bluetooth communication.
|
|
48
52
|
*/
|
|
@@ -91,36 +95,26 @@ export type DeviceErrorCode =
|
|
|
91
95
|
* Aligns with ConnectionAvailabilityStatus "location-disabled".
|
|
92
96
|
*/
|
|
93
97
|
| "location-disabled";
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
Connecting = "Connecting",
|
|
115
|
-
/**
|
|
116
|
-
* Partial flashing.
|
|
117
|
-
*/
|
|
118
|
-
PartialFlashing = "PartialFlashing",
|
|
119
|
-
/**
|
|
120
|
-
* Full flashing.
|
|
121
|
-
*/
|
|
122
|
-
FullFlashing = "FullFlashing"
|
|
123
|
-
}
|
|
98
|
+
/**
|
|
99
|
+
* Stages reported by the progress callback during connection and flashing.
|
|
100
|
+
*/
|
|
101
|
+
export declare const ProgressStage: {
|
|
102
|
+
/** Checking permissions and availability before connecting. */
|
|
103
|
+
readonly Initializing: "Initializing";
|
|
104
|
+
/** Finding device. */
|
|
105
|
+
readonly FindingDevice: "FindingDevice";
|
|
106
|
+
/** Checking that a bond is established. Only applicable on Native platforms. */
|
|
107
|
+
readonly CheckingBond: "CheckingBond";
|
|
108
|
+
/** Resetting device in preparation for flashing. Only applicable on Native platforms. */
|
|
109
|
+
readonly ResettingDevice: "ResettingDevice";
|
|
110
|
+
/** Connecting for flashing. */
|
|
111
|
+
readonly Connecting: "Connecting";
|
|
112
|
+
/** Partial flashing. */
|
|
113
|
+
readonly PartialFlashing: "PartialFlashing";
|
|
114
|
+
/** Full flashing. */
|
|
115
|
+
readonly FullFlashing: "FullFlashing";
|
|
116
|
+
};
|
|
117
|
+
export type ProgressStage = (typeof ProgressStage)[keyof typeof ProgressStage];
|
|
124
118
|
/**
|
|
125
119
|
* Progress callback for tracking operation stages (connection and flashing).
|
|
126
120
|
*
|
|
@@ -156,10 +150,15 @@ export declare class DeviceError extends Error {
|
|
|
156
150
|
message?: string;
|
|
157
151
|
});
|
|
158
152
|
}
|
|
153
|
+
/**
|
|
154
|
+
* Asserts that a connection is active, throwing a {@link DeviceError}
|
|
155
|
+
* with code `"not-connected"` if it is not.
|
|
156
|
+
*/
|
|
157
|
+
export declare function assertConnected<T>(connection: T | undefined): asserts connection is T;
|
|
159
158
|
/**
|
|
160
159
|
* Tracks connection status.
|
|
161
160
|
*/
|
|
162
|
-
export declare
|
|
161
|
+
export declare const ConnectionStatus: {
|
|
163
162
|
/**
|
|
164
163
|
* No device available.
|
|
165
164
|
*
|
|
@@ -169,26 +168,21 @@ export declare enum ConnectionStatus {
|
|
|
169
168
|
* Use checkAvailability() to determine whether the connection type is
|
|
170
169
|
* supported before attempting to connect.
|
|
171
170
|
*/
|
|
172
|
-
|
|
173
|
-
/**
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
|
|
179
|
-
*/
|
|
180
|
-
CONNECTED = "CONNECTED",
|
|
181
|
-
/**
|
|
182
|
-
* Connecting.
|
|
183
|
-
*/
|
|
184
|
-
CONNECTING = "CONNECTING",
|
|
171
|
+
readonly NoAuthorizedDevice: "NoAuthorizedDevice";
|
|
172
|
+
/** Authorized device available but we haven't connected to it. */
|
|
173
|
+
readonly Disconnected: "Disconnected";
|
|
174
|
+
/** Connected. */
|
|
175
|
+
readonly Connected: "Connected";
|
|
176
|
+
/** Connecting. */
|
|
177
|
+
readonly Connecting: "Connecting";
|
|
185
178
|
/**
|
|
186
179
|
* Paused due to tab visibility. The connection was temporarily suspended
|
|
187
180
|
* because the browser tab became hidden. Reconnection will be attempted
|
|
188
181
|
* automatically when the tab becomes visible again.
|
|
189
182
|
*/
|
|
190
|
-
|
|
191
|
-
}
|
|
183
|
+
readonly Paused: "Paused";
|
|
184
|
+
};
|
|
185
|
+
export type ConnectionStatus = (typeof ConnectionStatus)[keyof typeof ConnectionStatus];
|
|
192
186
|
export interface ConnectOptions {
|
|
193
187
|
/**
|
|
194
188
|
* Optional progress callback for tracking connection stages.
|
|
@@ -238,29 +232,22 @@ export declare class FlashDataError extends Error {
|
|
|
238
232
|
}
|
|
239
233
|
export type FlashDataSource = (boardVersion: BoardVersion) => Promise<string | Uint8Array>;
|
|
240
234
|
export type BoardVersion = "V1" | "V2";
|
|
241
|
-
export
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
constructor(status: ConnectionStatus, previousStatus: ConnectionStatus);
|
|
245
|
-
}
|
|
246
|
-
export declare class BeforeRequestDevice extends Event {
|
|
247
|
-
constructor();
|
|
248
|
-
}
|
|
249
|
-
export declare class AfterRequestDevice extends Event {
|
|
250
|
-
constructor();
|
|
235
|
+
export interface ConnectionStatusChange {
|
|
236
|
+
status: ConnectionStatus;
|
|
237
|
+
previousStatus: ConnectionStatus;
|
|
251
238
|
}
|
|
252
|
-
export
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
constructor(errorMessage: string, error?: unknown);
|
|
239
|
+
export interface BackgroundErrorData {
|
|
240
|
+
message: string;
|
|
241
|
+
error?: unknown;
|
|
256
242
|
}
|
|
257
|
-
export
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
|
|
261
|
-
|
|
243
|
+
export interface DeviceConnectionEventMap {
|
|
244
|
+
status: ConnectionStatusChange;
|
|
245
|
+
backgrounderror: BackgroundErrorData;
|
|
246
|
+
beforerequestdevice: void;
|
|
247
|
+
afterrequestdevice: void;
|
|
248
|
+
flash: void;
|
|
262
249
|
}
|
|
263
|
-
export interface DeviceConnection<M extends
|
|
250
|
+
export interface DeviceConnection<M> extends TypedEventTarget<DeviceConnectionEventMap & M> {
|
|
264
251
|
status: ConnectionStatus;
|
|
265
252
|
/**
|
|
266
253
|
* Initializes the device.
|
|
@@ -289,22 +276,42 @@ export interface DeviceConnection<M extends ValueIsEvent<M>> extends TypedEventT
|
|
|
289
276
|
/**
|
|
290
277
|
* Get the board version.
|
|
291
278
|
*
|
|
292
|
-
*
|
|
279
|
+
* Cached after the first successful connection until {@link clearDevice}
|
|
280
|
+
* is called, so remains available after disconnection.
|
|
281
|
+
*
|
|
282
|
+
* @returns the board version.
|
|
283
|
+
* @throws {DeviceError} with code `not-connected` if no device has been connected.
|
|
293
284
|
*/
|
|
294
|
-
getBoardVersion(): BoardVersion
|
|
285
|
+
getBoardVersion(): BoardVersion;
|
|
295
286
|
/**
|
|
296
287
|
* Disconnect from the device.
|
|
297
288
|
*/
|
|
298
289
|
disconnect(): Promise<void>;
|
|
299
290
|
/**
|
|
300
|
-
*
|
|
291
|
+
* Flash the micro:bit.
|
|
292
|
+
*
|
|
293
|
+
* Not all connection types support flashing. For example, radio bridge
|
|
294
|
+
* connections do not support flashing, and Bluetooth connections only
|
|
295
|
+
* support flashing on native platforms (not Web).
|
|
296
|
+
*
|
|
297
|
+
* Post-flash connection state differs by transport:
|
|
298
|
+
*
|
|
299
|
+
* - **USB**: The connection remains in {@link ConnectionStatus.Connected} state.
|
|
300
|
+
* USB connects to the micro:bit's interface chip (running DAPLink firmware),
|
|
301
|
+
* which is not affected by flashing the application processor, so the
|
|
302
|
+
* connection persists and serial communication is automatically reinitialised.
|
|
301
303
|
*
|
|
302
|
-
*
|
|
304
|
+
* - **Bluetooth**: The connection is always left in {@link ConnectionStatus.Disconnected}
|
|
305
|
+
* state. Bluetooth connects to the application processor directly, which
|
|
306
|
+
* reboots after flashing, so the connection is necessarily lost. Callers
|
|
307
|
+
* must call {@link connect} again after flashing.
|
|
303
308
|
*
|
|
304
|
-
* @param
|
|
305
|
-
* @
|
|
309
|
+
* @param dataSource The data to use.
|
|
310
|
+
* @param options Flash options and progress callback.
|
|
311
|
+
* @throws {DeviceError} On flash failure. The error.code property indicates the failure type.
|
|
312
|
+
* @throws {FlashDataError} If data preparation fails.
|
|
306
313
|
*/
|
|
307
|
-
|
|
314
|
+
flash?(dataSource: FlashDataSource, options: FlashOptions): Promise<void>;
|
|
308
315
|
/**
|
|
309
316
|
* Clear device to enable chooseDevice.
|
|
310
317
|
*/
|
package/build/cjs/device.js
CHANGED
|
@@ -1,37 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
*/
|
|
25
|
-
ProgressStage["Connecting"] = "Connecting";
|
|
26
|
-
/**
|
|
27
|
-
* Partial flashing.
|
|
28
|
-
*/
|
|
29
|
-
ProgressStage["PartialFlashing"] = "PartialFlashing";
|
|
30
|
-
/**
|
|
31
|
-
* Full flashing.
|
|
32
|
-
*/
|
|
33
|
-
ProgressStage["FullFlashing"] = "FullFlashing";
|
|
34
|
-
})(ProgressStage || (exports.ProgressStage = ProgressStage = {}));
|
|
3
|
+
exports.FlashDataError = exports.ConnectionStatus = exports.DeviceError = exports.ProgressStage = void 0;
|
|
4
|
+
exports.assertConnected = assertConnected;
|
|
5
|
+
/**
|
|
6
|
+
* Stages reported by the progress callback during connection and flashing.
|
|
7
|
+
*/
|
|
8
|
+
exports.ProgressStage = {
|
|
9
|
+
/** Checking permissions and availability before connecting. */
|
|
10
|
+
Initializing: "Initializing",
|
|
11
|
+
/** Finding device. */
|
|
12
|
+
FindingDevice: "FindingDevice",
|
|
13
|
+
/** Checking that a bond is established. Only applicable on Native platforms. */
|
|
14
|
+
CheckingBond: "CheckingBond",
|
|
15
|
+
/** Resetting device in preparation for flashing. Only applicable on Native platforms. */
|
|
16
|
+
ResettingDevice: "ResettingDevice",
|
|
17
|
+
/** Connecting for flashing. */
|
|
18
|
+
Connecting: "Connecting",
|
|
19
|
+
/** Partial flashing. */
|
|
20
|
+
PartialFlashing: "PartialFlashing",
|
|
21
|
+
/** Full flashing. */
|
|
22
|
+
FullFlashing: "FullFlashing",
|
|
23
|
+
};
|
|
35
24
|
/**
|
|
36
25
|
* Error type used for all interactions with this module.
|
|
37
26
|
*
|
|
@@ -54,11 +43,19 @@ class DeviceError extends Error {
|
|
|
54
43
|
}
|
|
55
44
|
}
|
|
56
45
|
exports.DeviceError = DeviceError;
|
|
46
|
+
/**
|
|
47
|
+
* Asserts that a connection is active, throwing a {@link DeviceError}
|
|
48
|
+
* with code `"not-connected"` if it is not.
|
|
49
|
+
*/
|
|
50
|
+
function assertConnected(connection) {
|
|
51
|
+
if (!connection) {
|
|
52
|
+
throw new DeviceError({ code: "not-connected", message: "Not connected" });
|
|
53
|
+
}
|
|
54
|
+
}
|
|
57
55
|
/**
|
|
58
56
|
* Tracks connection status.
|
|
59
57
|
*/
|
|
60
|
-
|
|
61
|
-
(function (ConnectionStatus) {
|
|
58
|
+
exports.ConnectionStatus = {
|
|
62
59
|
/**
|
|
63
60
|
* No device available.
|
|
64
61
|
*
|
|
@@ -68,104 +65,21 @@ var ConnectionStatus;
|
|
|
68
65
|
* Use checkAvailability() to determine whether the connection type is
|
|
69
66
|
* supported before attempting to connect.
|
|
70
67
|
*/
|
|
71
|
-
|
|
72
|
-
/**
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
/**
|
|
77
|
-
|
|
78
|
-
*/
|
|
79
|
-
ConnectionStatus["CONNECTED"] = "CONNECTED";
|
|
80
|
-
/**
|
|
81
|
-
* Connecting.
|
|
82
|
-
*/
|
|
83
|
-
ConnectionStatus["CONNECTING"] = "CONNECTING";
|
|
68
|
+
NoAuthorizedDevice: "NoAuthorizedDevice",
|
|
69
|
+
/** Authorized device available but we haven't connected to it. */
|
|
70
|
+
Disconnected: "Disconnected",
|
|
71
|
+
/** Connected. */
|
|
72
|
+
Connected: "Connected",
|
|
73
|
+
/** Connecting. */
|
|
74
|
+
Connecting: "Connecting",
|
|
84
75
|
/**
|
|
85
76
|
* Paused due to tab visibility. The connection was temporarily suspended
|
|
86
77
|
* because the browser tab became hidden. Reconnection will be attempted
|
|
87
78
|
* automatically when the tab becomes visible again.
|
|
88
79
|
*/
|
|
89
|
-
|
|
90
|
-
}
|
|
80
|
+
Paused: "Paused",
|
|
81
|
+
};
|
|
91
82
|
class FlashDataError extends Error {
|
|
92
83
|
}
|
|
93
84
|
exports.FlashDataError = FlashDataError;
|
|
94
|
-
class ConnectionStatusEvent extends Event {
|
|
95
|
-
constructor(status, previousStatus) {
|
|
96
|
-
super("status");
|
|
97
|
-
Object.defineProperty(this, "status", {
|
|
98
|
-
enumerable: true,
|
|
99
|
-
configurable: true,
|
|
100
|
-
writable: true,
|
|
101
|
-
value: status
|
|
102
|
-
});
|
|
103
|
-
Object.defineProperty(this, "previousStatus", {
|
|
104
|
-
enumerable: true,
|
|
105
|
-
configurable: true,
|
|
106
|
-
writable: true,
|
|
107
|
-
value: previousStatus
|
|
108
|
-
});
|
|
109
|
-
}
|
|
110
|
-
}
|
|
111
|
-
exports.ConnectionStatusEvent = ConnectionStatusEvent;
|
|
112
|
-
class BeforeRequestDevice extends Event {
|
|
113
|
-
constructor() {
|
|
114
|
-
super("beforerequestdevice");
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
exports.BeforeRequestDevice = BeforeRequestDevice;
|
|
118
|
-
class AfterRequestDevice extends Event {
|
|
119
|
-
constructor() {
|
|
120
|
-
super("afterrequestdevice");
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
exports.AfterRequestDevice = AfterRequestDevice;
|
|
124
|
-
class BackgroundErrorEvent extends Event {
|
|
125
|
-
constructor(errorMessage, error) {
|
|
126
|
-
super("backgrounderror");
|
|
127
|
-
Object.defineProperty(this, "errorMessage", {
|
|
128
|
-
enumerable: true,
|
|
129
|
-
configurable: true,
|
|
130
|
-
writable: true,
|
|
131
|
-
value: errorMessage
|
|
132
|
-
});
|
|
133
|
-
Object.defineProperty(this, "error", {
|
|
134
|
-
enumerable: true,
|
|
135
|
-
configurable: true,
|
|
136
|
-
writable: true,
|
|
137
|
-
value: error
|
|
138
|
-
});
|
|
139
|
-
}
|
|
140
|
-
}
|
|
141
|
-
exports.BackgroundErrorEvent = BackgroundErrorEvent;
|
|
142
|
-
class DeviceConnectionEventMap {
|
|
143
|
-
constructor() {
|
|
144
|
-
Object.defineProperty(this, "status", {
|
|
145
|
-
enumerable: true,
|
|
146
|
-
configurable: true,
|
|
147
|
-
writable: true,
|
|
148
|
-
value: void 0
|
|
149
|
-
});
|
|
150
|
-
Object.defineProperty(this, "backgrounderror", {
|
|
151
|
-
enumerable: true,
|
|
152
|
-
configurable: true,
|
|
153
|
-
writable: true,
|
|
154
|
-
value: void 0
|
|
155
|
-
});
|
|
156
|
-
Object.defineProperty(this, "beforerequestdevice", {
|
|
157
|
-
enumerable: true,
|
|
158
|
-
configurable: true,
|
|
159
|
-
writable: true,
|
|
160
|
-
value: void 0
|
|
161
|
-
});
|
|
162
|
-
Object.defineProperty(this, "afterrequestdevice", {
|
|
163
|
-
enumerable: true,
|
|
164
|
-
configurable: true,
|
|
165
|
-
writable: true,
|
|
166
|
-
value: void 0
|
|
167
|
-
});
|
|
168
|
-
}
|
|
169
|
-
}
|
|
170
|
-
exports.DeviceConnectionEventMap = DeviceConnectionEventMap;
|
|
171
85
|
//# sourceMappingURL=device.js.map
|
package/build/cjs/device.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/device.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"device.js","sourceRoot":"","sources":["../../src/device.ts"],"names":[],"mappings":";;;AA2KA,0CAMC;AAxED;;GAEG;AACU,QAAA,aAAa,GAAG;IAC3B,+DAA+D;IAC/D,YAAY,EAAE,cAAc;IAC5B,sBAAsB;IACtB,aAAa,EAAE,eAAe;IAC9B,gFAAgF;IAChF,YAAY,EAAE,cAAc;IAC5B,yFAAyF;IACzF,eAAe,EAAE,iBAAiB;IAClC,+BAA+B;IAC/B,UAAU,EAAE,YAAY;IACxB,wBAAwB;IACxB,eAAe,EAAE,iBAAiB;IAClC,qBAAqB;IACrB,YAAY,EAAE,cAAc;CACpB,CAAC;AA2BX;;;;;;;;GAQG;AACH,MAAa,WAAY,SAAQ,KAAK;IAEpC,YAAY,EAAE,IAAI,EAAE,OAAO,EAA+C;QACxE,KAAK,CAAC,OAAO,CAAC,CAAC;QAFjB;;;;;WAAsB;QAGpB,IAAI,CAAC,IAAI,GAAG,IAAI,CAAC;IACnB,CAAC;CACF;AAND,kCAMC;AAED;;;GAGG;AACH,SAAgB,eAAe,CAC7B,UAAyB;IAEzB,IAAI,CAAC,UAAU,EAAE,CAAC;QAChB,MAAM,IAAI,WAAW,CAAC,EAAE,IAAI,EAAE,eAAe,EAAE,OAAO,EAAE,eAAe,EAAE,CAAC,CAAC;IAC7E,CAAC;AACH,CAAC;AAED;;GAEG;AACU,QAAA,gBAAgB,GAAG;IAC9B;;;;;;;;OAQG;IACH,kBAAkB,EAAE,oBAAoB;IACxC,kEAAkE;IAClE,YAAY,EAAE,cAAc;IAC5B,iBAAiB;IACjB,SAAS,EAAE,WAAW;IACtB,kBAAkB;IAClB,UAAU,EAAE,YAAY;IACxB;;;;OAIG;IACH,MAAM,EAAE,QAAQ;CACR,CAAC;AAoDX,MAAa,cAAe,SAAQ,KAAK;CAAG;AAA5C,wCAA4C"}
|
package/build/cjs/events.d.ts
CHANGED
|
@@ -1,110 +1,11 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
* A function that can be passed to the `listener` parameter of {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
10
|
-
*
|
|
11
|
-
* @template M A map of event types to their respective event classes.
|
|
12
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
13
|
-
*/
|
|
14
|
-
export type TypedEventListener<M, T extends keyof M> = (evt: M[T]) => void | Promise<void>;
|
|
15
|
-
/**
|
|
16
|
-
* An object that can be passed to the `listener` parameter of {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
17
|
-
*
|
|
18
|
-
* @template M A map of event types to their respective event classes.
|
|
19
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
20
|
-
*/
|
|
21
|
-
export interface TypedEventListenerObject<M, T extends keyof M> {
|
|
22
|
-
handleEvent: (evt: M[T]) => void | Promise<void>;
|
|
23
|
-
}
|
|
24
|
-
/**
|
|
25
|
-
* Type of parameter `listener` in {@link TypedEventTarget.addEventListener} and {@link TypedEventTarget.removeEventListener}.
|
|
26
|
-
*
|
|
27
|
-
* The object that receives a notification (an object that implements the Event interface) when an event of the specified type occurs.
|
|
28
|
-
*
|
|
29
|
-
* Can be either an object with a handleEvent() method, or a JavaScript function.
|
|
30
|
-
*
|
|
31
|
-
* @template M A map of event types to their respective event classes.
|
|
32
|
-
* @template T The type of event to listen for (has to be keyof `M`).
|
|
33
|
-
*/
|
|
34
|
-
export type TypedEventListenerOrEventListenerObject<M, T extends keyof M> = TypedEventListener<M, T> | TypedEventListenerObject<M, T>;
|
|
35
|
-
export type ValueIsEvent<T> = {
|
|
36
|
-
[key in keyof T]: Event;
|
|
37
|
-
};
|
|
38
|
-
/**
|
|
39
|
-
* Typescript friendly version of {@link EventTarget}
|
|
40
|
-
*
|
|
41
|
-
* @template M A map of event types to their respective event classes.
|
|
42
|
-
*
|
|
43
|
-
* @example
|
|
44
|
-
* ```typescript
|
|
45
|
-
* interface MyEventMap {
|
|
46
|
-
* hello: Event;
|
|
47
|
-
* time: CustomEvent<number>;
|
|
48
|
-
* }
|
|
49
|
-
*
|
|
50
|
-
* const eventTarget = new TypedEventTarget<MyEventMap>();
|
|
51
|
-
*
|
|
52
|
-
* eventTarget.addEventListener('time', (event) => {
|
|
53
|
-
* // event is of type CustomEvent<number>
|
|
54
|
-
* });
|
|
55
|
-
* ```
|
|
56
|
-
*/
|
|
57
|
-
export interface TypedEventTarget<M extends ValueIsEvent<M>> {
|
|
58
|
-
/** Appends an event listener for events whose type attribute value is type.
|
|
59
|
-
* The callback argument sets the callback that will be invoked when the event
|
|
60
|
-
* is dispatched.
|
|
61
|
-
*
|
|
62
|
-
* The options argument sets listener-specific options. For compatibility this
|
|
63
|
-
* can be a boolean, in which case the method behaves exactly as if the value
|
|
64
|
-
* was specified as options's capture.
|
|
65
|
-
*
|
|
66
|
-
* When set to true, options's capture prevents callback from being invoked
|
|
67
|
-
* when the event's eventPhase attribute value is BUBBLING_PHASE. When false
|
|
68
|
-
* (or not present), callback will not be invoked when event's eventPhase
|
|
69
|
-
* attribute value is CAPTURING_PHASE. Either way, callback will be invoked if
|
|
70
|
-
* event's eventPhase attribute value is AT_TARGET.
|
|
71
|
-
*
|
|
72
|
-
* When set to true, options's passive indicates that the callback will not
|
|
73
|
-
* cancel the event by invoking preventDefault(). This is used to enable
|
|
74
|
-
* performance optimizations described in § 2.8 Observing event listeners.
|
|
75
|
-
*
|
|
76
|
-
* When set to true, options's once indicates that the callback will only be
|
|
77
|
-
* invoked once after which the event listener will be removed.
|
|
78
|
-
*
|
|
79
|
-
* The event listener is appended to target's event listener list and is not
|
|
80
|
-
* appended if it has the same type, callback, and capture. */
|
|
81
|
-
addEventListener: <T extends keyof M & string>(type: T, listener: TypedEventListenerOrEventListenerObject<M, T> | null, options?: boolean | AddEventListenerOptions) => void;
|
|
82
|
-
/** Removes the event listener in target's event listener list with the same
|
|
83
|
-
* type, callback, and options. */
|
|
84
|
-
removeEventListener: <T extends keyof M & string>(type: T, callback: TypedEventListenerOrEventListenerObject<M, T> | null, options?: EventListenerOptions | boolean) => void;
|
|
85
|
-
/**
|
|
86
|
-
* Dispatches a synthetic event event to target and returns true if either
|
|
87
|
-
* event's cancelable attribute value is false or its preventDefault() method
|
|
88
|
-
* was not invoked, and false otherwise.
|
|
89
|
-
* @deprecated To ensure type safety use `dispatchTypedEvent` instead.
|
|
90
|
-
*/
|
|
91
|
-
dispatchEvent: (event: Event) => boolean;
|
|
92
|
-
}
|
|
93
|
-
export declare class TrackingEventTarget extends EventTarget {
|
|
94
|
-
private activeEventTracking;
|
|
95
|
-
addEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: AddEventListenerOptions | boolean): void;
|
|
96
|
-
removeEventListener(type: string, callback: EventListenerOrEventListenerObject | null, options?: EventListenerOptions | boolean): void;
|
|
97
|
-
dispatchEvent(event: Event): boolean;
|
|
98
|
-
private filterRegistrations;
|
|
99
|
-
protected eventActivated(type: string): void;
|
|
100
|
-
protected eventDeactivated(type: string): void;
|
|
1
|
+
type Listener<T> = (data: T) => void;
|
|
2
|
+
export declare class TypedEventTarget<M> {
|
|
3
|
+
private listeners;
|
|
4
|
+
addEventListener<K extends keyof M & string>(type: K, listener: Listener<M[K]>): void;
|
|
5
|
+
removeEventListener<K extends keyof M & string>(type: K, listener: Listener<M[K]>): void;
|
|
6
|
+
protected dispatchEvent<K extends keyof M & string>(type: K, ...[data]: M[K] extends void ? [] : [data: M[K]]): void;
|
|
7
|
+
protected eventActivated(_type: string): void;
|
|
8
|
+
protected eventDeactivated(_type: string): void;
|
|
101
9
|
protected getActiveEvents(): string[];
|
|
102
10
|
}
|
|
103
|
-
export
|
|
104
|
-
/**
|
|
105
|
-
* Dispatches a synthetic event event to target and returns true if either
|
|
106
|
-
* event's cancelable attribute value is false or its preventDefault() method
|
|
107
|
-
* was not invoked, and false otherwise.
|
|
108
|
-
*/
|
|
109
|
-
dispatchTypedEvent<T extends keyof M>(_type: T, event: M[T]): boolean;
|
|
110
|
-
}
|
|
11
|
+
export {};
|