paranext / paranext-core

Electron client, extension host, and C# library for Paranext
https://paranext.github.io/paranext-core/
MIT License
17 stars 2 forks source link

PAPI: improve papi.webViews.onDidUpdateWebView to filter relevant updates #1328

Open Sebastian-ubs opened 1 day ago

Sebastian-ubs commented 1 day ago

User Story As an extension developer, I want effective papi methods so that I can easily listen for bcv changes.

Description In papi we have methods like papi.webViews.onDidUpdateWebView and papi.scrollGroups.onDidUpdateScrRef. Those are very helpful for listening on scripture reference changes. However using them I discovered that I had to manually keep track of some things:

To react on scroll group changes I am listening to papi.webViews.onDidUpdateWebView. However I saw this firing a lot also when there was no ref change happening. Fine, I thought I could filter that. But as the method does not indicate WHAT the change was that cause it (e.g. a ref change or something else) I could not easily filter those changes. Also as there is no old value provided to compare, I had to maintain my own list again.

Implementation idea enhance papi.webViews.onDidUpdateWebView to

Testing ideas Be able to create an extension that listens to scroll group changes only without getting any other webview updates