File tree Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Expand file tree Collapse file tree 2 files changed +40
-0
lines changed Original file line number Diff line number Diff line change 1+ // Polyfill for writeValueWithResponse and writeValueWithoutResponse
2+
3+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
4+ if ( typeof ( window as any ) . BluetoothRemoteGATTCharacteristic !== 'undefined' ) {
5+ // eslint-disable-next-line @typescript-eslint/no-explicit-any
6+ const proto = ( window as any ) . BluetoothRemoteGATTCharacteristic . prototype as any ;
7+
8+ if ( ! proto . writeValueWithResponse ) {
9+ proto . writeValueWithResponse = function ( value : BufferSource ) {
10+ // Fallback to writeValue if available
11+ if ( typeof this . writeValue === 'function' ) {
12+ return this . writeValue ( value ) ;
13+ }
14+ return Promise . reject (
15+ new Error (
16+ 'writeValueWithResponse and writeValue are not supported on this device' ,
17+ ) ,
18+ ) ;
19+ } ;
20+ }
21+
22+ if ( ! proto . writeValueWithoutResponse ) {
23+ proto . writeValueWithoutResponse = function ( value : BufferSource ) {
24+ // Fallback to writeValue if available
25+ if ( typeof this . writeValue === 'function' ) {
26+ return this . writeValue ( value ) ;
27+ }
28+ return Promise . reject (
29+ new Error (
30+ 'writeValueWithoutResponse and writeValue are not supported on this device' ,
31+ ) ,
32+ ) ;
33+ } ;
34+ }
35+ }
36+
37+ export { } ;
38+ // --- IGNORE ---
Original file line number Diff line number Diff line change 11// SPDX-License-Identifier: MIT
22// Copyright (c) 2020-2023 The Pybricks Authors
33
4+ import './bleWritePolyfill' ;
5+
46import './index.scss' ;
57import { HotkeysProvider , OverlayToaster } from '@blueprintjs/core' ;
68import { configureStore } from '@reduxjs/toolkit' ;
You can’t perform that action at this time.
0 commit comments