-
Notifications
You must be signed in to change notification settings - Fork 23
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
refactor: remove Node-specific APIs. #56
base: master
Are you sure you want to change the base?
Conversation
@thegecko I added an (also unfinished) |
I've enabled prebuilds on this PR which pass 👍
Running the test suite
|
Finally got around to fixing this. The ESLint errors were pretty easy. I eventually figured out the problem with the error was with the tsconfig target being set to es5. Changing it to es2016 did the trick. ES5 was actually removing the classes and compiling them down to old functions. Some other changes:
|
…luetooth into replace-node-specific-apis
Thanks @Symbitic All the tests pass with physical hardware, I need to look through the code changes... |
@Symbitic I saw you now defined also the Advertisement data event ... did you also added code to "simulate" it being fired when someone calls watchAdvertisements on the device? Because they should be relatively straight forward, or? Most of teh data are present in the device ... and then it would be ,more standard conform here. |
@Apollon77 I have a hard time understanding what you are asking for. watchAdvertisements is not yet stable in the webbluetooth spec, so it's difficult to implement at this time. |
Ok sorry, I wasn't aware that this is not stable (but Chrome already supports it behind a feature flag) ... Thoight might be an option too |
@Symbitic I've revisited this PR many times with a view to merge it but keep getting quite lost. I think it's because so much has changed (e.g. it looks like files have been renamed and the adapter abstraction has been removed). I can see this isn't an easy task but is there any way you can simplify this PR and reduce the churn? |
I'll see what I can do. I may need to open a new PR and abandon this one. I'll definitely remove |
Thanks and sorry I'm not being very timely with supporting your merges |
This PR is intended to replace as many Node-specific APIs with their standardized equivalents. The number one thing it does is replace EventEmitter with EventTarget. I did my best to make sure nothing is a breaking change, but I'm putting this in as a draft because I'm not certain of it yet.
I'd hoped to only change the adapters for this PR and leave changing the types and Events stuff for a later PR, but that wasn't possible since
EventDispatcher
depended on EventEmitter. I'm really sorry for that; if there are any changes you want me to make, I'll do my best. For now, I'm leaving Deno for another PR.I did add support for a
SIMPLEBLE_ADAPTER
environment variable for if a user has more than one Bluetooth adapter and wants to select a particular one.Thanks again for your great work on this.