opto / Imageview

Thunderbird addon to view images in attachments
Other
2 stars 2 forks source link

improve APIs to make them self contained #1

Closed jobisoft closed 3 years ago

jobisoft commented 3 years ago

The goal of this PR is to clean up the Experiment API to make it self-contained and independent of other code in the add-on, so it can be replaced more easily.

I purposely used modern methods, to showcase how things can be done, for example promisifying the stream listener, so it is more easy to let it "return" something in a normal (async) execution flow.

I also reduced redundancy.

I completely uncommented usage of the WL API. The messenger injection was just used to make the WL object avail, which is not needed and can be done with other means. Preferences for new add-ons should be stored in local storage and not in the prefBranch. I have not understood the purpose of the download injection. I might need some info what it does and how to trigger it, so I can propose to do this is a dedicated Experiment not using the WL API.

You can contact me via any channel you like to discuss these change proposals.

I like the idea of this add-on very much!

jobisoft commented 3 years ago

What could be done as well is to get rid of Experiments completely by using a simple JS mime parser: https://github.com/jobisoft/Imageview/tree/pure

I have not made a PR for this yet, as I do not know, which direction you want to go. But I will continue to work on that mimeparser and make it available to developers as an alternative to Experiments, which cause the ugly "this add-on can do anything" waring.

What I still need to understand (and work on) is your download stuff inside an Experiment. If you could give more details, that would be great. From my expectations, I would assume I can download the image directly from the viewer and for that I do not need an experiment.