-
-
Notifications
You must be signed in to change notification settings - Fork 84
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
Export Readers for TypeScript #365
Conversation
Change Log for @ericblade/quagga2 (1.3.0 → 1.4.0)New Features
|
9f8e696
to
1a89e5d
Compare
hi @benk-lastyard thanks for the pull request! I'll take a quick look at it |
Awesome! |
@benk-lastyard i really do appreciate the typescript updates! When I went through and converted the readers all over to typescript i tried to do a lot of cleanups like that, but obviously i missed some things. Let me ask you this -- what would you think of adding an index.ts to src/reader, which imports the individual readers, and then exports them, like the first part of the change 1a89e5d#diff-eea04ce1ae4f8822f870f8d3ac9534c16295a179248987b68f7f58eef30d739b then we only need a single import added to quagga.js, like
and then follow that up with
so if you're extending the reader from external code, you would do something like
would that work? Also, please add yourself to Contributors in package.json, if you'd like credit beyond the github repo! |
@ericblade No problem with your suggestion. I am far from a Typescript master but I'll try and follow your suggested code snippets above and see how far I get. Should I move Line 143 in 0b3e3b1
I'll make a start on the suggested changes in the meantime. |
@benk-lastyard Good idea, i was thinking of that, too. I'm not aware of anyone actively using that, so I'm not incredibly worried about it breaking any thing people are actually using, so let's go ahead and move that (and if anyone does complain, I can just reissue it as v2.0.0, which i'll need to do anyway when i remove official node 10 support, which i just made a todo issue for) TypeScript is mostly great! I've loved using it, but I'm no master at it either! |
Hi @ericblade, Are you able to offer any guidance on how I would update
I have tried
|
Hi @ericblade The code has been updated based on your feedback here Regards |
LGTM :) Thank you! |
Thanks @ericblade |
Hi,
The main reason behind this pull request is that I would like to extend one of the barcode readers to create a custom barcode reader of my own. The problem I had is that
quagga.d.ts
doesn't export the reader class that I need to extend.This pull request adds all of the reader classes to
quagga.d.ts
. In doing so I have also made these other changesprotected
access modifier to most functions in the reader classes that have an underscore prefix. This seemed to be the original intent however without the access modifier they would all be public. Since these classes were not exported previously there should be no usages outside of this project so the change seems safe to me.BarcodeReader._decode
toBarcodeReader.decode
. This is because theEANReader
attempts to call that function for each of the supplementary readers so thedecode
function cannot be protected.