Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Check that Web Bluetooth is available #223

Merged
merged 3 commits into from
Feb 14, 2024
Merged

Conversation

microbit-robert
Copy link

Bluetooth can be blocked by system policies and this additional check determines if this is the case.

Bluetooth can be blocked by system policies.
Copy link

Copy link

@microbit-grace microbit-grace left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Didn't manage to test in iOS, but code-wise it looks good to me.

@@ -20,7 +20,7 @@ import { DeviceRequestStates } from '../microbit-interfacing/MicrobitConnection'
let text: (key: string, vars?: object) => string;
t.subscribe(t => (text = t));

export const compatibility = writable<CompatibilityStatus>(checkCompatibility());
export const compatibility = writable<CompatibilityStatus>(await checkCompatibility());

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How worried should I be that this has regressed browser compatibility by using top-level await?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Very broken on Chrome 88:
Uncaught SyntaxError: Unexpected reserved word

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Making this a draft until resolved.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We have another one in i18n.ts:

await init({
  fallbackLocale: 'en',
  initialLocale: get(persistantLocale),
  // Needed to format <link> style tags.
  ignoreTag: false,
});

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is already broken for Chrome 88 due to the await in i18n.ts. We'll come back to this later to attempt to target es2017 and lose both top-level awaits.

@microbit-robert microbit-robert marked this pull request as draft February 13, 2024 16:33
@microbit-robert microbit-robert marked this pull request as ready for review February 14, 2024 09:37
@microbit-robert microbit-robert merged commit b3dcebc into main Feb 14, 2024
1 check passed
@microbit-robert microbit-robert deleted the bluetooth-availability branch February 14, 2024 09:38
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.

None yet

3 participants