aadsm / jsmediatags

Media Tags Reader (ID3, MP4, FLAC)
Other
752 stars 128 forks source link

Callback like "onComplete"? #100

Closed Black-Platypus closed 5 years ago

Black-Platypus commented 5 years ago

First, I could not find a documentation table of all the methods and their signatures on the jsmediatags object -- is there a place where such is maintained?

Feature request: an "always" or "onComplete" callback for the .read method which would fire in both success and error cases, improving flow and readability/maintainability

Thank you so much for the module so far! đź‘Ť

aadsm commented 5 years ago

The reference in the README should have all the public methods documented: https://github.com/aadsm/jsmediatags#reference. Is there any particular one you’d like to see better documented or that is missing?

I won’t be opposed to an onComplete method. Would you like to add it and make a PR? It should be fairly simple to implement, you need to add it here: https://github.com/aadsm/jsmediatags/blob/dad42a42c9a6da8ee80f1bc125527ed5b40cbd8d/src/jsmediatags.js#L69. Call it from the onSuccess and wrap the onError to also call onComplete.